[RFC PATCH 2/4] verify-tag.c: ignore SIGPIPE around gpg invocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



builtin-verify-tag.c already sets SIG_IGN for SIGPIPE before calling
verify_tag, but new callers of verify_tag_sha1 may not have modified the
signal handler, and shouldn't have to.  Save and restore the signal
handler for SIGPIPE around the invocation of gpg.

Signed-off-by: Deskin Miller <deskinm@xxxxxxxxx>
---
 verify-tag.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/verify-tag.c b/verify-tag.c
index c9be331..c3e35f3 100644
--- a/verify-tag.c
+++ b/verify-tag.c
@@ -7,6 +7,7 @@
 #include "cache.h"
 #include "object.h"
 #include "run-command.h"
+#include <signal.h>
 
 #define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
 
@@ -17,6 +18,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
 	char path[PATH_MAX], *eol;
 	size_t len;
 	int fd, ret;
+	sighandler_t save_handle;
 
 	fd = git_mkstemp(path, PATH_MAX, ".git_vtag_tmpXXXXXX");
 	if (fd < 0)
@@ -40,8 +42,10 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
 	gpg.argv = args_gpg;
 	gpg.in = -1;
 	args_gpg[2] = path;
+	save_handle = signal(SIGPIPE, SIG_IGN);
 	if (start_command(&gpg)) {
 		unlink(path);
+		signal(SIGPIPE, save_handle);
 		return error("could not run gpg.");
 	}
 
@@ -50,6 +54,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
 	ret = finish_command(&gpg);
 
 	unlink(path);
+	signal(SIGPIPE, save_handle);
 
 	return ret;
 }
-- 
1.6.0.4.770.ga8394

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux