Index: slowcgi.c =================================================================== RCS file: /cvs/src/usr.sbin/slowcgi/slowcgi.c,v retrieving revision 1.44 diff -u -p -r1.44 slowcgi.c --- slowcgi.c 22 Jan 2015 18:22:27 -0000 1.44 +++ slowcgi.c 20 Aug 2015 11:38:28 -0000 @@ -849,11 +849,14 @@ exec_cgi(struct request *c) i = 0; - if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, s_in) == -1) + if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, + PF_UNSPEC, s_in) == -1) lerr(1, "socketpair"); - if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, s_out) == -1) + if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, + PF_UNSPEC, s_out) == -1) lerr(1, "socketpair"); - if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, s_err) == -1) + if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, + PF_UNSPEC, s_err) == -1) lerr(1, "socketpair"); cgi_inflight--; c->inflight_fds_accounted = 1; @@ -926,17 +929,6 @@ exec_cgi(struct request *c) close(s_in[1]); close(s_out[1]); close(s_err[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 (ioctl(s_in[0], FIONBIO, &on) == -1) - lerr(1, "script ioctl(FIONBIO)"); - if (ioctl(s_out[0], FIONBIO, &on) == -1) - lerr(1, "script ioctl(FIONBIO)"); - if (ioctl(s_err[0], FIONBIO, &on) == -1) - lerr(1, "script ioctl(FIONBIO)"); c->script_pid = pid; event_set(&c->script_stdin_ev, s_in[0], EV_WRITE | EV_PERSIST,