[PATCH v6 2/6] http: avoid closing index-pack input twice

Ted Nyman <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <28662b0fd892ecf6246be185ccb2d4654fb780a5.1785111375.git.tnyman@openai.com>
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 <[email protected]>
---
 http.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/http.c b/http.c
index caccf2108e..89a1ccc6d2 100644
--- 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;
 }
-- 
2.55.0.openai.131.g83a728de1eb6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.