aboutsummaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-24 05:45:46 -0400
committerJunio C Hamano <gitster@pobox.com>2014-06-25 15:27:24 -0700
commit28bf9429ef2e1534be8d3a59ad236834be542b86 (patch)
tree29036aa31a53372b6b37bb2b0ad57a04a2f7f816 /daemon.c
parent3cc9d87710b20c86252809e068fe309f6bb7ecc2 (diff)
downloadgit-28bf9429ef2e1534be8d3a59ad236834be542b86.tar.gz
git-28bf9429ef2e1534be8d3a59ad236834be542b86.tar.xz
avoid double close of descriptors handed to run_command
When a file descriptor is given to run_command via the "in", "out", or "err" parameters, run_command takes ownership. The descriptor will be closed in the parent process whether the process is spawned successfully or not, and closing it again is wrong. In practice this has not caused problems, because we usually close() right after start_command returns, meaning no other code has opened a descriptor in the meantime. So we just get EBADF and ignore it (rather than accidentally closing somebody else's descriptor!). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/daemon.c b/daemon.c
index eba125568..a2701af2f 100644
--- a/daemon.c
+++ b/daemon.c
@@ -783,7 +783,6 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
logerror("unable to fork");
else
add_child(&cld, addr, addrlen);
- close(incoming);
}
static void child_handler(int signo)