]> git.ipfire.org Git - thirdparty/git.git/commitdiff
connected: close err_fd in promisor fast-path
authorEthan Dickson <ethanndickson@gmail.com>
Fri, 15 May 2026 06:39:54 +0000 (06:39 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 16 May 2026 13:16:43 +0000 (22:16 +0900)
connected.h documents that err_fd is closed before check_connected()
returns. It is, on three of four exit paths. The promisor-pack fast
path added in 50033772d (connected: verify promisor-ness of partial
clone, 2020-01-30) returns 0 without closing it.

receive-pack uses err_fd as the write end of an async sideband
muxer's pipe, and the muxer thread waits for EOF. The same omission
has caused deadlocks there twice before: 49ecfa13f (receive-pack:
close sideband fd on early pack errors, 2013-04-19) and 6cdad1f13
(receive-pack: fix deadlock when we cannot create tmpdir,
2017-03-07).

Signed-off-by: Ethan Dickson <ethanndickson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connected.c

index 79403108dd8f574af7fcdb478975b17ceba76d25..6d7549a0f7ee582c1db8ead8919bf0341e53b76d 100644 (file)
@@ -91,6 +91,8 @@ promisor_pack_found:
                        ;
                } while ((oid = fn(cb_data)) != NULL);
                free(new_pack);
+               if (opt->err_fd)
+                       close(opt->err_fd);
                return 0;
        }