Problem: Not checking for failed open(). (Coverity)
Solution: Check file descriptor not being negative.
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);
}
/* 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);
}
/* 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);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1595,
/**/
1594,
/**/