summaryrefslogtreecommitdiff
blob: c20403983ba925094da4af951834837a7ce11f0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Ripped from Fedora

--- gzip-1.3.1/zgrep.in
+++ gzip-1.3.1/zgrep.in
@@ -92,6 +92,7 @@
 fi
 
 res=0
+trap break SIGPIPE
 for i do
   gzip -cdfq "$i" |
     if test $files_with_matches -eq 1; then
@@ -110,5 +111,8 @@
     fi
   r=$?
   test $res -lt $r && res=$r
+  # SIGPIPE + 128
+  test "$r" -eq 141 && exit $res
 done
+trap - SIGPIPE
 exit $res