Mercurial > vim
changeset 8611:f12689430f4b v7.4.1595
commit https://github.com/vim/vim/commit/c0a1d7f3ad4d41b64c6c881bb8ad7c201f8439a3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 19 14:12:50 2016 +0100
patch 7.4.1595
Problem: Not checking for failed open(). (Coverity)
Solution: Check file descriptor not being negative.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 19 Mar 2016 14:15:05 +0100 |
parents | 00dc4a8866d2 |
children | 6e76a0cca2b5 |
files | src/os_unix.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -5150,7 +5150,7 @@ mch_start_job(char **argv, job_T *job, j 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, j } /* 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, j } /* 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);