diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-11-10 00:57:49 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-11-10 00:58:12 -0800 |
commit | 4962e55522a41562a00e8a881ce7b2427564a6dd (patch) | |
tree | c4c01fb87271ce0c4f3cdaa4c72208291493c4ce | |
parent | eca422584b9aca740d13c02e92e113225bc8c30f (diff) | |
download | gzip-4962e55522a41562a00e8a881ce7b2427564a6dd.tar.gz |
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).
-rw-r--r-- | zgrep.in | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -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 |