diff options
author | Johannes Sixt <johannes.sixt@telecom.at> | 2008-02-16 18:36:38 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-23 11:59:44 -0800 |
commit | e72ae28895b22052b7ca2eef36c039ac62671f7d (patch) | |
tree | 35e5df11a285b4467054fcec75cf8e35f38093e1 /receive-pack.c | |
parent | 923d44aeb7cb6d21eeb459fdc1b58137e37c2b1c (diff) | |
download | git-e72ae28895b22052b7ca2eef36c039ac62671f7d.tar.gz |
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 <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'receive-pack.c')
-rw-r--r-- | receive-pack.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/receive-pack.c b/receive-pack.c index 3267495832..a971433db1 100644 --- a/receive-pack.c +++ b/receive-pack.c @@ -132,6 +132,7 @@ static int run_hook(const char *hook_name) break; } } + close(proc.in); return hook_status(finish_command(&proc), hook_name); } @@ -414,6 +415,7 @@ static const char *unpack(void) if (start_command(&ip)) return "index-pack fork failed"; pack_lockfile = index_pack_lockfile(ip.out); + close(ip.out); status = finish_command(&ip); if (!status) { reprepare_packed_git(); |