send-pack: avoid deadlock when pack-object dies early
[gitweb.git] / builtin-send-pack.c
index 2478e1851a355f48f2af228e46934aa3c8fc1c9d..651628871176e5d7569659aafc5b5d262c3f1987 100644 (file)
@@ -97,6 +97,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
                free(buf);
                close(po.out);
                po.out = -1;
+               close(fd);
        }
 
        if (finish_command(&po))
@@ -375,6 +376,9 @@ static void print_helper_status(struct ref *ref)
 static int sideband_demux(int in, int out, void *data)
 {
        int *fd = data;
+#ifndef WIN32
+       close(fd[1]);
+#endif
        int ret = recv_sideband("send-pack", fd[0], out);
        close(out);
        return ret;