From f51f164df0e8a2c0e055174b328b4038a040e547 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 24 Jun 2019 09:31:16 +0200 Subject: [PATCH] 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 --- bzip2.c | 14 ++++++++------ 1 file 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[] ) testf ( aa->name ); } } - if (testFailsExist && noisy) { - fprintf ( stderr, - "\n" - "You can use the `bzip2recover' program to attempt to recover\n" - "data from undamaged sections of corrupted files.\n\n" - ); + if (testFailsExist) { + if (noisy) { + fprintf ( stderr, + "\n" + "You can use the `bzip2recover' program to attempt to recover\n" + "data from undamaged sections of corrupted files.\n\n" + ); + } setExit(2); exit(exitValue); } -- 2.43.5