summaryrefslogtreecommitdiff
path: root/gpg-interface.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2013-01-31 10:18:40 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-31 11:10:44 -0800
commit7dac3f83218b9f6c4c7d1c1cf093190f20d27108 (patch)
tree7c70a82ddb09f2d9b5aa4b2ba26061efd4759f74 /gpg-interface.c
parent2f47eae2a1337bd0cb50dbc936df6433f460bb4a (diff)
downloadgit-7dac3f83218b9f6c4c7d1c1cf093190f20d27108.tar.gz
gpg: close stderr once finished with it in verify_signed_buffer()
Failing to close the stderr pipe in verify_signed_buffer() causes git to run out of file descriptors if there are many calls to verify_signed_buffer(). An easy way to trigger this is to run git log --show-signature --merges | grep "key" on the linux kernel git repo. Eventually it will fail with error: cannot create pipe for gpg: Too many open files error: could not run gpg. Close the stderr pipe so that this can't happen. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gpg-interface.c')
-rw-r--r--gpg-interface.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gpg-interface.c b/gpg-interface.c
index ff232c8c5d..bcf55a433e 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -128,8 +128,10 @@ int verify_signed_buffer(const char *payload, size_t payload_size,
write_in_full(gpg.in, payload, payload_size);
close(gpg.in);
- if (gpg_output)
+ if (gpg_output) {
strbuf_read(gpg_output, gpg.err, 0);
+ close(gpg.err);
+ }
ret = finish_command(&gpg);
unlink_or_warn(path);