Skip to content

Commit b109bb4

Browse files
committed
patch 8.0.0980: Coverity warning for failing to open /dev/null
Problem: Coverity warning for failing to open /dev/null. Solution: When /dev/null can't be opened exit the child.
1 parent eef0531 commit b109bb4

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/os_unix.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4340,6 +4340,7 @@ mch_call_shell(
43404340

43414341
# define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use
43424342
127, some shells use that already */
4343+
# define OPEN_NULL_FAILED 123 /* Exit code if /dev/null can't be opened */
43434344

43444345
char_u *newcmd;
43454346
pid_t pid;
@@ -5369,7 +5370,14 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
53695370
}
53705371

53715372
if (use_null_for_in || use_null_for_out || use_null_for_err)
5373+
{
53725374
null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0);
5375+
if (null_fd < 0)
5376+
{
5377+
perror("opening /dev/null failed");
5378+
_exit(OPEN_NULL_FAILED);
5379+
}
5380+
}
53735381

53745382
if (pty_slave_fd >= 0)
53755383
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
980,
772774
/**/
773775
979,
774776
/**/

0 commit comments

Comments
 (0)