From: Paul Eggert Date: Wed, 10 Nov 2010 08:57:49 +0000 (-0800) Subject: zgrep: don't assume traditional behavior with signal numbers X-Git-Tag: v1.5~53 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=4962e55522a41562a00e8a881ce7b2427564a6dd;p=debian%2Fgzip zgrep: don't assume traditional behavior with signal numbers * zgrep.in: Don't assume the exit status is the signal number plus 128, as POSIX doesn't require this. No need to kill self; exiting with large status is enough. Propagate all exit statuses greater than 1, not merely those in the range 129..143, as there's no need to treat that range specially (and it's not portable anyway). --- diff --git a/zgrep.in b/zgrep.in index 68396db..d0dea15 100644 --- a/zgrep.in +++ b/zgrep.in @@ -210,14 +210,11 @@ do (eval "$grep" 4>&-; echo $? >&4) 3>&- | sed "$sed_script" >&3 4>&- ) && exit $r r=$? - test $r -gt 128 && test $r -le 143 && exit $r || exit 2 + test 1 -lt $r && exit $r || exit 2 fi >&3 5>&- ) r=$? - if test $r -gt 128 && test $r -le 143; then - kill -$(($r-128)) $$ - exit $r - fi + test 128 -lt $r && exit $r test "$gzip_status" -eq 0 || test "$gzip_status" -eq 2 || r=2 test $res -lt $r && res=$r done