summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2016-04-16 12:42:01 +0000
committerbapt <bapt@FreeBSD.org>2016-04-16 12:42:01 +0000
commit9b89fc0844a135e094027368a901e9db83e255ed (patch)
tree09541f6a983c097223f3d9cdf76dbf74ff466356
parent6a3bf4fe17acd8740c761dbeba19407a21635508 (diff)
downloadFreeBSD-src-9b89fc0844a135e094027368a901e9db83e255ed.zip
FreeBSD-src-9b89fc0844a135e094027368a901e9db83e255ed.tar.gz
Use pipe2(2) to directly set the close-on-exec flags directly
MFC after: 1 week
-rw-r--r--usr.sbin/inetd/inetd.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 09690ab..f2d504f 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -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++;
OpenPOWER on IntegriCloud