set cloexec status on the socketpair fds

the executor forks to spawn the cgi scripts, and they inherit the
socket for communication with the listener process.  Make that
impossible.
This commit is contained in:
Omar Polo 2021-01-31 11:07:12 +00:00
parent 91d7870bb7
commit 8503a1431d
1 changed files with 2 additions and 1 deletions

3
gmid.c
View File

@ -582,7 +582,8 @@ main(int argc, char **argv)
fatal("daemon: %s", strerror(errno));
}
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, p) == -1)
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC,
PF_UNSPEC, p) == -1)
fatal("socketpair: %s", strerror(errno));
switch (fork()) {