Check return code from open()

This commit is contained in:
Simon Kelley
2016-03-01 16:19:23 +00:00
parent aa300f7167
commit f7cf749943

View File

@@ -561,11 +561,14 @@ int main (int argc, char **argv)
{
/* open stdout etc to /dev/null */
int nullfd = open("/dev/null", O_RDWR);
if (nullfd != -1)
{
dup2(nullfd, STDOUT_FILENO);
dup2(nullfd, STDERR_FILENO);
dup2(nullfd, STDIN_FILENO);
close(nullfd);
}
}
/* if we are to run scripts, we need to fork a helper before dropping root. */
daemon->helperfd = -1;