chiark / gitweb /
polypath: Close parent's socket in child
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 1 Oct 2014 17:20:44 +0000 (18:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 9 Oct 2014 18:29:59 +0000 (19:29 +0100)
Previously this would happen automatically due to CLOEXEC, but we are
going to have a long-running child, which needs to not have a copy of
this fd.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
polypath.c

index 770ffc2a3d81879681f6bf72042b81e15e3578cf..58a89ee9f0cc978add45ca6a95d170103360b69a 100644 (file)
@@ -475,6 +475,7 @@ static void start_subproc(struct polypath *st, void (*make_fdpair)(int[2]),
     pid_t pid=fork();
     if (!pid) {
        afterfork();
+       close(pfds[0]);
        child(st,pfds[1]);
        abort();
     }