Unbreak syslogd after r310494

Don't close all file descriptors greater than STDERR_FILENO (2) in
waitdaemon(..) -- only close fd (file descriptor for /dev/null used in
subsequent calls to dup2) if it's greater than STDERR_FILENO.

Reported by:	subbsd@gmail.com, danny@cs.huji.ac.il
Pointyhat to:	hrs
X-MFC with:	r310494
This commit is contained in:
ngie 2016-12-24 12:50:17 +00:00
parent 764feb9929
commit e9becac72d

View File

@ -2348,7 +2348,8 @@ waitdaemon(int maxwait)
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
closefrom(STDERR_FILENO + 1);
if (fd > STDERR_FILENO)
(void)close(fd);
}
return (getppid());
}