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>
Tue, 21 Oct 2014 00:07:11 +0000 (01:07 +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 770ffc2..58a89ee 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();
     }