diff options
author | florian | 2013-10-18 14:42:18 +0000 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-05-24 12:33:55 +0200 |
commit | 0bbc81788f09d70eec5f9038b4387eda225ee0cc (patch) | |
tree | e4dce10cc88ce770f0930bf16e5ad3b04939d8b1 /slowcgi.c | |
parent | 97262cef8889fbd49be086afab75d923898495e4 (diff) | |
download | slowcgi-0bbc81788f09d70eec5f9038b4387eda225ee0cc.tar.gz |
set FD_CLOEXEC OK blambert
Diffstat (limited to 'slowcgi.c')
-rw-r--r-- | slowcgi.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: slowcgi.c,v 1.11 2013/09/19 09:21:29 blambert Exp $ */ +/* $OpenBSD: slowcgi.c,v 1.12 2013/10/18 14:42:18 florian Exp $ */ /* * Copyright (c) 2013 David Gwynne <dlg@openbsd.org> * Copyright (c) 2013 Florian Obser <florian@openbsd.org> @@ -25,6 +25,7 @@ #include <sys/un.h> #include <sys/wait.h> #include <err.h> +#include <fcntl.h> #include <ctype.h> #include <errno.h> #include <event.h> @@ -307,6 +308,7 @@ slowcgi_listen(char *path, gid_t gid) if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) lerr(1, "slowcgi_listen: socket"); + fcntl(fd, F_SETFD, FD_CLOEXEC); bzero(&sun, sizeof(sun)); sun.sun_family = AF_UNIX; @@ -388,6 +390,7 @@ slowcgi_accept(int fd, short events, void *arg) } } + fcntl(s, F_SETFD, FD_CLOEXEC); if (ioctl(s, FIONBIO, &on) == -1) lerr(1, "request ioctl(FIONBIO)"); @@ -801,6 +804,10 @@ exec_cgi(struct request *c) /* Parent process*/ close(s[1]); close(s_err[1]); + + fcntl(s[0], F_SETFD, FD_CLOEXEC); + fcntl(s_err[0], F_SETFD, FD_CLOEXEC); + if (ioctl(s[0], FIONBIO, &on) == -1) lerr(1, "script ioctl(FIONBIO)"); if (ioctl(s_err[0], FIONBIO, &on) == -1) |