To: vim_dev@googlegroups.com Subject: Patch 7.4.1595 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1595 Problem: Not checking for failed open(). (Coverity) Solution: Check file descriptor not being negative. Files: src/os_unix.c *** ../vim-7.4.1594/src/os_unix.c 2016-03-19 14:11:14.247040239 +0100 --- src/os_unix.c 2016-03-19 14:05:21.646727700 +0100 *************** *** 5150,5156 **** null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0); /* set up stdin for the child */ ! if (use_null_for_in) { close(0); ignored = dup(null_fd); --- 5150,5156 ---- null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0); /* set up stdin for the child */ ! if (use_null_for_in && null_fd >= 0) { close(0); ignored = dup(null_fd); *************** *** 5165,5171 **** } /* set up stderr for the child */ ! if (use_null_for_err) { close(2); ignored = dup(null_fd); --- 5165,5171 ---- } /* set up stderr for the child */ ! if (use_null_for_err && null_fd >= 0) { close(2); ignored = dup(null_fd); *************** *** 5185,5191 **** } /* set up stdout for the child */ ! if (use_null_for_out) { close(0); ignored = dup(null_fd); --- 5185,5191 ---- } /* set up stdout for the child */ ! if (use_null_for_out && null_fd >= 0) { close(0); ignored = dup(null_fd); *** ../vim-7.4.1594/src/version.c 2016-03-19 14:11:14.247040239 +0100 --- src/version.c 2016-03-19 14:12:23.018321150 +0100 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1595, /**/ -- hundred-and-one symptoms of being an internet addict: 83. Batteries in the TV remote now last for months. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///