To: vim_dev@googlegroups.com Subject: Patch 8.0.0980 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0980 Problem: Coverity warning for failing to open /dev/null. Solution: When /dev/null can't be opened exit the child. Files: src/os_unix.c *** ../vim-8.0.0979/src/os_unix.c 2017-08-20 18:09:09.767276733 +0200 --- src/os_unix.c 2017-08-21 21:04:18.643833401 +0200 *************** *** 4340,4345 **** --- 4340,4346 ---- # define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use 127, some shells use that already */ + # define OPEN_NULL_FAILED 123 /* Exit code if /dev/null can't be opened */ char_u *newcmd; pid_t pid; *************** *** 5369,5375 **** --- 5370,5383 ---- } if (use_null_for_in || use_null_for_out || use_null_for_err) + { null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0); + if (null_fd < 0) + { + perror("opening /dev/null failed"); + _exit(OPEN_NULL_FAILED); + } + } if (pty_slave_fd >= 0) { *** ../vim-8.0.0979/src/version.c 2017-08-20 20:21:19.614457312 +0200 --- src/version.c 2017-08-21 20:36:49.314053325 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 980, /**/ -- The fastest way to get an engineer to solve a problem is to declare that the problem is unsolvable. No engineer can walk away from an unsolvable problem until it's solved. (Scott Adams - The Dilbert principle) /// 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 ///