aboutsummaryrefslogtreecommitdiff
path: root/builtin-tag.c
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2008-02-16 18:36:38 +0100
committerJunio C Hamano <gitster@pobox.com>2008-02-23 11:59:44 -0800
commite72ae28895b22052b7ca2eef36c039ac62671f7d (patch)
tree35e5df11a285b4467054fcec75cf8e35f38093e1 /builtin-tag.c
parent923d44aeb7cb6d21eeb459fdc1b58137e37c2b1c (diff)
downloadgit-e72ae28895b22052b7ca2eef36c039ac62671f7d.tar.gz
git-e72ae28895b22052b7ca2eef36c039ac62671f7d.tar.xz
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 'builtin-tag.c')
-rw-r--r--builtin-tag.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-tag.c b/builtin-tag.c
index 716b4fff3..28c36fdcd 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -226,12 +226,13 @@ static int do_sign(struct strbuf *buffer)
if (write_in_full(gpg.in, buffer->buf, buffer->len) != buffer->len) {
close(gpg.in);
+ close(gpg.out);
finish_command(&gpg);
return error("gpg did not accept the tag data");
}
close(gpg.in);
- gpg.close_in = 0;
len = strbuf_read(buffer, gpg.out, 1024);
+ close(gpg.out);
if (finish_command(&gpg) || !len || len < 0)
return error("gpg failed to sign the tag");