]> git.ipfire.org Git - thirdparty/git.git/commitdiff
http: avoid closing index-pack input twice
authorTed Nyman <tnyman@openai.com>
Mon, 27 Jul 2026 00:28:39 +0000 (17:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Jul 2026 19:57:20 +0000 (12:57 -0700)
finish_http_pack_request() passes its staging-file descriptor to
index-pack through child_process.in. start_command() takes ownership
of a supplied descriptor and closes it, even when starting the child
fails.

Do not close the descriptor again after run_command() returns.

Signed-off-by: Ted Nyman <tnyman@openai.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c

diff --git a/http.c b/http.c
index b4e7b8d00b3cdc2b9289f7cc47db8403e1057ab4..930e0d227fda73073305c6fb30a59fb9df2235ae 100644 (file)
--- a/http.c
+++ b/http.c
@@ -2704,13 +2704,8 @@ int finish_http_pack_request(struct http_pack_request *preq)
        else
                ip.no_stdout = 1;
 
-       if (run_command(&ip)) {
+       if (run_command(&ip))
                ret = -1;
-               goto cleanup;
-       }
-
-cleanup:
-       close(tmpfile_fd);
        unlink(preq->tmpfile.buf);
        return ret;
 }