From 1c673e5681720491a74fc4b2992e075f47302c22 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 31 Jul 2011 11:01:47 +0300 Subject: Fix exit status of "xzdiff foo.xz bar.xz". xzdiff was clobbering the exit status from diff in a case statement used to analyze the exit statuses from "xz" when its operands were two compressed files. Save and restore diff's exit status to fix this. The bug is inherited from zdiff in GNU gzip and was fixed there on 2009-10-09. Thanks to Jonathan Nieder for the patch and to Peter Pallinger for reporting the bug. --- src/scripts/xzdiff.in | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in index 0fa446f6..e6e38429 100644 --- a/src/scripts/xzdiff.in +++ b/src/scripts/xzdiff.in @@ -126,10 +126,12 @@ elif test $# -eq 2; then ( ($xz2 -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- &3) 5<&0 ) + cmp_status=$? case $xz_status in *[1-9]*) xz_status=1;; *) xz_status=0;; esac + (exit $cmp_status) else F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog tmp= -- cgit v1.2.3