- if test $r -gt 128 && test $r -le 143; then
- kill -$(($r-128)) $$
- exit $r
- fi
- test "$gzip_status" -eq 0 || test "$gzip_status" -eq 2 || r=2
- test $res -lt $r && res=$r
+
+ # Ignore gzip status 2, as it is just a warning.
+ # gzip status 1 is an error, like grep status 2.
+ test $gzip_status -eq 2 && gzip_status=0
+ test $gzip_status -eq 1 && gzip_status=2
+
+ # Use the more serious of the grep and gzip statuses.
+ test $r -lt $gzip_status && r=$gzip_status
+
+ # Exit immediately on software configuration error.
+ test 126 -le $r && exit $r
+
+ # Accumulate the greatest status, except consider 0 to be greater than 1.
+ if test $r -le 1 && test $res -le 1; then
+ test $r -lt $res
+ else
+ test $res -lt $r
+ fi && res=$r