mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Use daemonfd(3) in the dhclient(8).
Reviewed by: brooks@ Differential Revision: https://reviews.freebsd.org/D13603
This commit is contained in:
parent
0fd25723bc
commit
3169840599
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328803
@ -2430,7 +2430,7 @@ go_daemon(void)
|
||||
/* Stop logging to stderr... */
|
||||
log_perror = 0;
|
||||
|
||||
if (daemon(1, 1) == -1)
|
||||
if (daemonfd(-1, nullfd) == -1)
|
||||
error("daemon");
|
||||
|
||||
cap_rights_init(&rights);
|
||||
@ -2443,11 +2443,7 @@ go_daemon(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* we are chrooted, daemon(3) fails to open /dev/null */
|
||||
if (nullfd != -1) {
|
||||
dup2(nullfd, STDIN_FILENO);
|
||||
dup2(nullfd, STDOUT_FILENO);
|
||||
dup2(nullfd, STDERR_FILENO);
|
||||
close(nullfd);
|
||||
nullfd = -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user