aboutsummaryrefslogtreecommitdiff
path: root/src/lzma/io.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-05-04 22:29:27 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-05-04 22:29:27 +0300
commit944b62b93239b27b338d117f2668c0e95849659b (patch)
treed18207ef110eb348a8fb733d2ecc96117d4ec595 /src/lzma/io.c
parentFix a crash with --format=alone if other filters than LZMA (diff)
downloadxz-944b62b93239b27b338d117f2668c0e95849659b.tar.xz
Don't print an error message on broken pipe unless --verbose
is used.
Diffstat (limited to '')
-rw-r--r--src/lzma/io.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lzma/io.c b/src/lzma/io.c
index a7683fcc..b972099f 100644
--- a/src/lzma/io.c
+++ b/src/lzma/io.c
@@ -651,7 +651,20 @@ io_write(const file_pair *pair, const uint8_t *buf, size_t size)
continue;
}
- errmsg(V_ERROR, _("%s: Write error: %s"),
+ // Handle broken pipe specially. gzip and bzip2
+ // don't print anything on SIGPIPE. In addition,
+ // gzip --quiet uses exit status 2 (warning) on
+ // broken pipe instead of whatever raise(SIGPIPE)
+ // would make it return. It is there to hide "Broken
+ // pipe" message on some old shells (probably old
+ // GNU bash).
+ //
+ // We don't do anything special with --quiet, which
+ // is what bzip2 does too. However, we print a
+ // message if --verbose was used (or should that
+ // only be with double --verbose i.e. debugging?).
+ errmsg(errno == EPIPE ? V_VERBOSE : V_ERROR,
+ _("%s: Write error: %s"),
pair->dest_name, strerror(errno));
return -1;
}