aboutsummaryrefslogtreecommitdiff
path: root/bzip2.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-06-24 09:31:16 +0200
committerMark Wielaard <mark@klomp.org>2019-06-24 09:31:16 +0200
commitf51f164df0e8a2c0e055174b328b4038a040e547 (patch)
treebc008281f68827e616e6c8549e0ccef35c1bb34e /bzip2.c
parentc1cdd98db3238cb711c7d9cdc5671452ce2822cb (diff)
downloadbzip2-f51f164df0e8a2c0e055174b328b4038a040e547.tar.gz
bzip2-f51f164df0e8a2c0e055174b328b4038a040e547.tar.bz2
bzip2-f51f164df0e8a2c0e055174b328b4038a040e547.zip
bzip2: Fix return value when combining --test,-t and -q.
When passing -q to get quiet output --test would not display an error message, but would also suppress the exit 2 code to indicate the file was corrupt. Only suppress the error message with -q, not the exit value. This patch comes from Debian. "bunzip2 -qt returns 0 for corrupt archives" https://bugs.debian.org/279025
Diffstat (limited to 'bzip2.c')
-rw-r--r--bzip2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/bzip2.c b/bzip2.c
index 854a2bb..63649f6 100644
--- a/bzip2.c
+++ b/bzip2.c
@@ -2003,12 +2003,14 @@ IntNative main ( IntNative argc, Char *argv[] )
2003 testf ( aa->name ); 2003 testf ( aa->name );
2004 } 2004 }
2005 } 2005 }
2006 if (testFailsExist && noisy) { 2006 if (testFailsExist) {
2007 fprintf ( stderr, 2007 if (noisy) {
2008 "\n" 2008 fprintf ( stderr,
2009 "You can use the `bzip2recover' program to attempt to recover\n" 2009 "\n"
2010 "data from undamaged sections of corrupted files.\n\n" 2010 "You can use the `bzip2recover' program to attempt to recover\n"
2011 ); 2011 "data from undamaged sections of corrupted files.\n\n"
2012 );
2013 }
2012 setExit(2); 2014 setExit(2);
2013 exit(exitValue); 2015 exit(exitValue);
2014 } 2016 }