From e72ae28895b22052b7ca2eef36c039ac62671f7d Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sat, 16 Feb 2008 18:36:38 +0100 Subject: start_command(), .in/.out/.err = -1: Callers must close the file descriptor By setting .in, .out, or .err members of struct child_process to -1, the callers of start_command() can request that a pipe is allocated that talks to the child process and one end is returned by replacing -1 with the file descriptor. Previously, a flag was set (for .in and .out, but not .err) to signal finish_command() to close the pipe end that start_command() had handed out, so it was optional for callers to close the pipe, and many already do so. Now we make it mandatory to close the pipe. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- builtin-fetch-pack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'builtin-fetch-pack.c') diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index f40135248..5ea48ca7d 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -538,8 +538,10 @@ static int get_pack(int xd[2], char **pack_lockfile) cmd.git_cmd = 1; if (start_command(&cmd)) die("fetch-pack: unable to fork off %s", argv[0]); - if (do_keep && pack_lockfile) + if (do_keep && pack_lockfile) { *pack_lockfile = index_pack_lockfile(cmd.out); + close(cmd.out); + } if (finish_command(&cmd)) die("%s failed", argv[0]); -- cgit v1.2.1