FD_CLOEXEC
(void) fcntl(SHIN = dcopy(0, FSHIN), F_SETFD, FD_CLOEXEC);
(void) fcntl(SHOUT = dcopy(1, FSHOUT), F_SETFD, FD_CLOEXEC);
(void) fcntl(SHERR = dcopy(2, FSHERR), F_SETFD, FD_CLOEXEC);
(void) fcntl(OLDSTD = dcopy(SHIN, FOLDSTD), F_SETFD, FD_CLOEXEC);
(void) fcntl(SHIN, F_SETFD, FD_CLOEXEC);
(void) fcntl(dcopy(f, FSHTTY), F_SETFD, FD_CLOEXEC);
(void) fcntl(unit, F_SETFD, FD_CLOEXEC);
fcntl(i, F_SETFD, FD_CLOEXEC);
fcntl(nfd, F_SETFD, FD_CLOEXEC);
fcntl(fd, F_SETFD, FD_CLOEXEC);
fcntl(fd, F_SETFD, FD_CLOEXEC);
if (flags != -1 && (flags & FD_CLOEXEC) == 0)
(void)fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
if (flags == -1 || ((flags & FD_CLOEXEC) &&
fcntl(pdes[target], F_SETFD, flags & ~FD_CLOEXEC)
fcntl(pdes[target], F_SETFD, flags & ~FD_CLOEXEC);
((flags & FD_CLOEXEC) &&
fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) == -1))
if ((oflags & O_CLOEXEC) && !((tmp = fcntl(fd, F_GETFD)) & FD_CLOEXEC))
fcntl(fd, F_SETFD, tmp | FD_CLOEXEC);
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
ATF_REQUIRE((fcntl(fd[0], F_GETFD) & FD_CLOEXEC) != 0);
ATF_REQUIRE((fcntl(fd[1], F_GETFD) & FD_CLOEXEC) != 0);
ATF_REQUIRE((fcntl(fd[0], F_GETFD) & FD_CLOEXEC) == 0);
ATF_REQUIRE((fcntl(fd[1], F_GETFD) & FD_CLOEXEC) == 0);
ATF_REQUIRE((fcntl(fd[0], F_GETFD) & FD_CLOEXEC) != 0);
ATF_REQUIRE((fcntl(fd[1], F_GETFD) & FD_CLOEXEC) != 0);
ATF_REQUIRE((fcntl(fd[0], F_GETFD) & FD_CLOEXEC) == 0);
ATF_REQUIRE((fcntl(fd[1], F_GETFD) & FD_CLOEXEC) == 0);
if (fcntl(fd, F_SETFD, FD_CLOEXEC))
*retval = (fdp->fd_ofileflags[fd] & UF_EXCLOSE ? FD_CLOEXEC : 0)
i = ((long)SCARG(uap, arg) & FD_CLOEXEC ? UF_EXCLOSE : 0) |
(void) fcntl(fileno(fp), F_SETFD, FD_CLOEXEC);
(void)fcntl(p[READ], F_SETFD, FD_CLOEXEC);
(void)fcntl(p[WRITE], F_SETFD, FD_CLOEXEC);
(void)fcntl(fileno(fp), F_SETFD, FD_CLOEXEC);
(void)fcntl(fileno(fp), F_SETFD, FD_CLOEXEC);
if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1 ||
(void)fcntl(rfd, F_SETFD, FD_CLOEXEC);
(void)fcntl(wfd, F_SETFD, FD_CLOEXEC);
(void)fcntl(efd, F_SETFD, FD_CLOEXEC);
if (fcntl(x, F_SETFD, FD_CLOEXEC) == -1) \
(void)fcntl(sock, F_SETFD, FD_CLOEXEC);
if (fcntl(listen_sock, F_SETFD, FD_CLOEXEC) == -1) {
if (tty_log_fd != -1 && fcntl(tty_log_fd, F_SETFD, FD_CLOEXEC) == -1)
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
fcntl(s_in[0], F_SETFD, FD_CLOEXEC);
fcntl(s_out[0], F_SETFD, FD_CLOEXEC);
fcntl(s_err[0], F_SETFD, FD_CLOEXEC);
fcntl(fdsig[0], F_SETFD, FD_CLOEXEC) == -1 ||
fcntl(fdsig[1], F_SETFD, FD_CLOEXEC) == -1)
fcntl(nsd->verifier_pipe[0], F_SETFD, FD_CLOEXEC);
fcntl(nsd->verifier_pipe[1], F_SETFD, FD_CLOEXEC);
if(fcntl(sock->s, F_SETFD, FD_CLOEXEC) == -1) {
if (fcntl(CONSTRAINT_PASSFD, F_SETFD, FD_CLOEXEC) == -1)
fcntl(s_in[0], F_SETFD, FD_CLOEXEC);
fcntl(s_out[0], F_SETFD, FD_CLOEXEC);
fcntl(s_err[0], F_SETFD, FD_CLOEXEC);
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {