Re: [PATCH v6 2/6] http: avoid closing index-pack input twice
Jeff King <[email protected]> Sat, 1 Aug 2026 09:53:13 -0400
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Jul 26, 2026 at 05:28:39PM -0700, Ted Nyman wrote:
> 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.
Thanks for splitting this out.
> @@ -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);
The patch _could_ just be a one-liner dropping this close(). Removing
the cleanup label here is optional, but is a simplification that works
because nobody else jumps to it (which must be true because we'd fail to
compile otherwise).
I probably would have mentioned that in the commit message, but I think
there's diminishing returns in trying to polish further.
-Peff