svn commit: r298111 - head/usr.sbin/inetd

Baptiste Daroussin bapt at FreeBSD.org
Sat Apr 16 12:42:02 UTC 2016


Author: bapt
Date: Sat Apr 16 12:42:01 2016
New Revision: 298111
URL: https://svnweb.freebsd.org/changeset/base/298111

Log:
  Use pipe2(2) to directly set the close-on-exec flags directly
  
  MFC after:	1 week

Modified:
  head/usr.sbin/inetd/inetd.c

Modified: head/usr.sbin/inetd/inetd.c
==============================================================================
--- head/usr.sbin/inetd/inetd.c	Sat Apr 16 12:32:26 2016	(r298110)
+++ head/usr.sbin/inetd/inetd.c	Sat Apr 16 12:42:01 2016	(r298111)
@@ -539,15 +539,10 @@ main(int argc, char **argv)
 		(void)setenv("inetd_dummy", dummy, 1);
 	}
 
-	if (pipe(signalpipe) != 0) {
+	if (pipe2(signalpipe, O_CLOEXEC) != 0) {
 		syslog(LOG_ERR, "pipe: %m");
 		exit(EX_OSERR);
 	}
-	if (fcntl(signalpipe[0], F_SETFD, FD_CLOEXEC) < 0 ||
-	    fcntl(signalpipe[1], F_SETFD, FD_CLOEXEC) < 0) {
-		syslog(LOG_ERR, "signalpipe: fcntl (F_SETFD, FD_CLOEXEC): %m");
-		exit(EX_OSERR);
-	}
 	FD_SET(signalpipe[0], &allsock);
 #ifdef SANITY_CHECK
 	nsock++;


More information about the svn-src-head mailing list