Use pipe2(2) to directly set the close-on-exec flags directly
MFC after: 1 week
This commit is contained in:
parent
7b7b2a3b8a
commit
29808109ea
@ -539,15 +539,10 @@ main(int argc, char **argv)
|
|||||||
(void)setenv("inetd_dummy", dummy, 1);
|
(void)setenv("inetd_dummy", dummy, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipe(signalpipe) != 0) {
|
if (pipe2(signalpipe, O_CLOEXEC) != 0) {
|
||||||
syslog(LOG_ERR, "pipe: %m");
|
syslog(LOG_ERR, "pipe: %m");
|
||||||
exit(EX_OSERR);
|
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);
|
FD_SET(signalpipe[0], &allsock);
|
||||||
#ifdef SANITY_CHECK
|
#ifdef SANITY_CHECK
|
||||||
nsock++;
|
nsock++;
|
||||||
|
Loading…
Reference in New Issue
Block a user