]> granicus.if.org Git - vim/commitdiff
patch 7.4.1595 v7.4.1595
authorBram Moolenaar <Bram@vim.org>
Sat, 19 Mar 2016 13:12:50 +0000 (14:12 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 19 Mar 2016 13:12:50 +0000 (14:12 +0100)
Problem:    Not checking for failed open(). (Coverity)
Solution:   Check file descriptor not being negative.

src/os_unix.c
src/version.c

index a9c20c991ce1490a29ac52883395253bffe84bf0..4cc9de7c46461e869e02500fb309ae0535b40e8c 100644 (file)
@@ -5150,7 +5150,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
            null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0);
 
        /* set up stdin for the child */
-       if (use_null_for_in)
+       if (use_null_for_in && null_fd >= 0)
        {
            close(0);
            ignored = dup(null_fd);
@@ -5165,7 +5165,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
        }
 
        /* set up stderr for the child */
-       if (use_null_for_err)
+       if (use_null_for_err && null_fd >= 0)
        {
            close(2);
            ignored = dup(null_fd);
@@ -5185,7 +5185,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
        }
 
        /* set up stdout for the child */
-       if (use_null_for_out)
+       if (use_null_for_out && null_fd >= 0)
        {
            close(0);
            ignored = dup(null_fd);
index 06cec58dd3a54ab197a0f0feb7d7470063d03046..bc817d7396f4bdcd5dafc4836040dd1a153e0b57 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1595,
 /**/
     1594,
 /**/