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, 2 Oct 2014 15:41:56 +0000 (16:41 +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 a07bdfc5fc4381dee37cae8b639497b2fc8cc195..8b60ac2136eb9148c0a23af58c0f069cb07e7d94 100644 (file)
@@ -474,6 +474,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();
     }