mingw: ensure temporary file handles are not inherited by child processes
[gitweb.git] / gpg-interface.c
index 3dc2fe397e32d79713780596f0ef4666c14b5955..c4b1e8c78d396194753d8a7287678bc476f858d6 100644 (file)
@@ -219,11 +219,9 @@ int verify_signed_buffer(const char *payload, size_t payload_size,
        args_gpg[0] = gpg_program;
        fd = git_mkstemp(path, PATH_MAX, ".git_vtag_tmpXXXXXX");
        if (fd < 0)
-               return error(_("could not create temporary file '%s': %s"),
-                            path, strerror(errno));
+               return error_errno(_("could not create temporary file '%s'"), path);
        if (write_in_full(fd, signature, signature_size) < 0)
-               return error(_("failed writing detached signature to '%s': %s"),
-                            path, strerror(errno));
+               return error_errno(_("failed writing detached signature to '%s'"), path);
        close(fd);
 
        gpg.argv = args_gpg;
@@ -237,6 +235,7 @@ int verify_signed_buffer(const char *payload, size_t payload_size,
                return error(_("could not run gpg."));
        }
 
+       sigchain_push(SIGPIPE, SIG_IGN);
        write_in_full(gpg.in, payload, payload_size);
        close(gpg.in);
 
@@ -250,6 +249,7 @@ int verify_signed_buffer(const char *payload, size_t payload_size,
        close(gpg.out);
 
        ret = finish_command(&gpg);
+       sigchain_pop(SIGPIPE);
 
        unlink_or_warn(path);