git-upload-pack: make sure we close unused pipe ends
authorH. Peter Anvin <hpa@zytor.com>
Tue, 27 Mar 2007 23:45:06 +0000 (16:45 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 28 Mar 2007 00:05:12 +0000 (17:05 -0700)
Right now, we don't close the read end of the pipe when git-upload-pack
runs git-pack-object, so we hang forever (why don't we get SIGALRM?)
instead of dying with SIGPIPE if the latter dies, which seems to be the
norm if the client disconnects.

Thanks to Johannes Schindelin <Johannes.Schindelin@gmx.de> for
pointing out where this close() needed to go.

This patch has been tested on kernel.org for several weeks and appear
to resolve the problem of git-upload-pack processes hanging around
forever.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
upload-pack.c

index 498bf50eb86f9e437dae89fc631499b73a8ec116..d3a09e78d56642db9b1fb1b1ead34ff60dd8c923 100644 (file)
@@ -119,6 +119,7 @@ static void create_pack_file(void)
                int i;
                struct rev_info revs;
 
+               close(lp_pipe[0]);
                pack_pipe = fdopen(lp_pipe[1], "w");
 
                if (create_full_pack)