svn commit: r328803 - head/sbin/dhclient

Mariusz Zaborski oshogbo at FreeBSD.org
Fri Feb 2 18:11:56 UTC 2018


Author: oshogbo
Date: Fri Feb  2 18:11:56 2018
New Revision: 328803
URL: https://svnweb.freebsd.org/changeset/base/328803

Log:
  Use daemonfd(3) in the dhclient(8).
  
  Reviewed by:	brooks@
  Differential Revision:	https://reviews.freebsd.org/D13603

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==============================================================================
--- head/sbin/dhclient/dhclient.c	Fri Feb  2 18:10:45 2018	(r328802)
+++ head/sbin/dhclient/dhclient.c	Fri Feb  2 18:11:56 2018	(r328803)
@@ -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;
 	}


More information about the svn-src-all mailing list