Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Apr 2016 12:42:01 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r298111 - head/usr.sbin/inetd
Message-ID:  <201604161242.u3GCg1KN074524@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604161242.u3GCg1KN074524>