git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Schneider <larsxschneider@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, benpeart@microsoft.com
Subject: [PATCH v1] convert: fix return value for apply_multi_file_filter() on SIGPIPE
Date: Mon, 10 Apr 2017 22:30:11 +0200	[thread overview]
Message-ID: <20170410203011.54103-1-larsxschneider@gmail.com> (raw)

If a pipe write fails and errno is set to EPIPE then we execute the
"error" path. However, as "err" can still be 0 the return value of
apply_multi_file_filter() would indicate success.

Fix this by setting "err" to the value of "errno" in case of a pipe
write failure.

Noticed-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---

Notes:
    Base Ref: master
    Web-Diff: https://github.com/larsxschneider/git/commit/41a217c246
    Checkout: git fetch https://github.com/larsxschneider/git errno-check-v1 && git checkout 41a217c246

 convert.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/convert.c b/convert.c
index 8d652bf27c..586e0cdd45 100644
--- a/convert.c
+++ b/convert.c
@@ -753,6 +753,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
 	sigchain_pop(SIGPIPE);
 
 	if (err || errno == EPIPE) {
+		err = err ? err : errno;
 		if (!strcmp(filter_status.buf, "error")) {
 			/* The filter signaled a problem with the file. */
 		} else if (!strcmp(filter_status.buf, "abort")) {

base-commit: b14f27f91770e0f99f64135348977a0ce1c7993a
-- 
2.12.2


                 reply	other threads:[~2017-04-10 20:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170410203011.54103-1-larsxschneider@gmail.com \
    --to=larsxschneider@gmail.com \
    --cc=benpeart@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).