aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2009-06-08 10:51:22 +0200
committerJunio C Hamano <gitster@pobox.com>2009-06-08 21:18:41 -0700
commit3ef67cf250b14b9c62b2bd21e4d0d5339f5f31e5 (patch)
treeae4219712b1182374188250e49966865e240cb5e
parent956d27a872a70f40f98c3f710553ef619959e212 (diff)
downloadgit-3ef67cf250b14b9c62b2bd21e4d0d5339f5f31e5.tar.gz
git-3ef67cf250b14b9c62b2bd21e4d0d5339f5f31e5.tar.xz
fetch-pack: close output channel after sideband demultiplexer terminates
fetch-pack runs the sideband demultiplexer using start_async(). This facility requires that the asynchronously executed function closes the output file descriptor (see Documentation/technical/api-run-command.txt). But the sideband demultiplexer did not do that. This fixes it. In certain error situations this could lock up a fetch operation on Windows because the asynchronous function is run in a thread; by not closing the output fd the reading end never got EOF and waited for more data indefinitely. On Unix this is not a problem because the asynchronous function is run in a separate process, which exits after the function ends and so implicitly closes the output. Since the pack that is sent over the wire encodes the number of objects in the stream, during normal operation the reading end knows when the stream ends and terminates by itself, and does not lock up. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-fetch-pack.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 620246221..629735f54 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -483,7 +483,9 @@ static int sideband_demux(int fd, void *data)
{
int *xd = data;
- return recv_sideband("fetch-pack", xd[0], fd);
+ int ret = recv_sideband("fetch-pack", xd[0], fd);
+ close(fd);
+ return ret;
}
static int get_pack(int xd[2], char **pack_lockfile)