dhclient(8) should not close stdio using daemon(3) function.

dhclient(8) is chrooted so opening /dev/null always will fail.
In capability world this is also annoying because we getting error that
open(2) is not permitted in Capsicum. dhclient(8) is closing stdio by
precaching fd to /dev/null before chroot.
This is done few lines below daemon(3) function so let's not try to do that
in daemon(3) function.

Reviewed by:	cem@
Differential Revision:	https://reviews.freebsd.org/D12826
This commit is contained in:
Mariusz Zaborski 2017-11-12 08:54:23 +00:00
parent cb003dd918
commit 6789a8b559
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325741

View File

@ -2423,7 +2423,7 @@ go_daemon(void)
/* Stop logging to stderr... */
log_perror = 0;
if (daemon(1, 0) == -1)
if (daemon(1, 1) == -1)
error("daemon");
cap_rights_init(&rights);