summaryrefslogtreecommitdiff
blob: 0e4908f1e1e7a4bfb1a9ad0103abd6fe8bd31548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Hunks ripped from Debian's patchset.

--- gzip-1.3.5.orig/gzexe.in
+++ gzip-1.3.5/gzexe.in
@@ -42,8 +42,10 @@
   exit 1
 fi
 
+set -C
 tmp=gz$$
-trap "rm -f $tmp; exit 1" 1 2 3 5 10 13 15
+trap "rm -f $tmp; exit 1" HUP INT QUIT TRAP USR1 PIPE TERM
+: > $tmp || exit 1
 
 decomp=0
 res=0
@@ -53,8 +55,8 @@
   shift
 fi
 
-echo hi > zfoo1$$
-echo hi > zfoo2$$
+echo hi > zfoo1$$ || exit 1
+echo hi > zfoo2$$ || exit 1
 if test -z "`(${CPMOD-cpmod} zfoo1$$ zfoo2$$) 2>&1`"; then
   cpmod=${CPMOD-cpmod}
 fi
@@ -110,26 +112,28 @@
       writable=0
       chmod u+w $tmp 2>/dev/null
     fi
+    : >| $tmp  # truncate the file, ignoring set -C
   fi
   if test $decomp -eq 0; then
-    sed 1q $0 > $tmp
+    sed 1q $0 >> $tmp
     sed "s|^if tail|if $tail|" >> $tmp <<'EOF'
-skip=22
+skip=23
 set -C
 umask=`umask`
 umask 77
-if tail +$skip "$0" | "BINDIR"/gzip -cd > /tmp/gztmp$$; then
+tmpfile=`tempfile -p gztmp -d /tmp` || exit 1
+if tail +$skip "$0" | /bin/gzip -cd >> $tmpfile; then
   umask $umask
-  /bin/chmod 700 /tmp/gztmp$$
+  /bin/chmod 700 $tmpfile
   prog="`echo $0 | /bin/sed 's|^.*/||'`"
-  if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then
-    trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0
-    (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null &
+  if /bin/ln $tmpfile "/tmp/$prog" 2>/dev/null; then
+    trap '/bin/rm -f $tmpfile "/tmp/$prog"; exit $res' 0
+    (/bin/sleep 5; /bin/rm -f $tmpfile "/tmp/$prog") 2>/dev/null &
     /tmp/"$prog" ${1+"$@"}; res=$?
   else
-    trap '/bin/rm -f /tmp/gztmp$$; exit $res' 0
-    (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$) 2>/dev/null &
-    /tmp/gztmp$$ ${1+"$@"}; res=$?
+    trap '/bin/rm -f $tmpfile; exit $res' 0
+    (/bin/sleep 5; /bin/rm -f $tmpfile) 2>/dev/null &
+    $tmpfile ${1+"$@"}; res=$?
   fi
 else
   echo Cannot decompress $0; exit 1
@@ -144,8 +148,8 @@
 
   else
     # decompression
-    skip=22
-    if sed -e 1d -e 2q "$i" | grep "^skip=[0-9][0-9]*$" >/dev/null; then
+    skip=23
+    if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then
       eval `sed -e 1d -e 2q "$i"`
     fi
     if tail +$skip "$i" | gzip -cd > $tmp; then
--- gzip-1.3.5.orig/zmore.in
+++ gzip-1.3.5/zmore.in
@@ -34,16 +34,16 @@
   cb='min 1 -icanon'; ncb='icanon eof ^d'
 fi
 if test $? -eq 0 && test -n "$oldtty"; then
-   trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
+   trap 'stty $oldtty 2>/dev/null; exit' INT QUIT TRAP USR1 PIPE TERM
 else
-   trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
+   trap 'stty $ncb echo 2>/dev/null; exit' INT QUIT TRAP USR1 PIPE TERM
 fi
 
 if test $# = 0; then
     if test -t 0; then
 	echo usage: ${ZMORE_PROGRAM_NAME-zmore} files...
     else
-	gzip -cdfq | eval ${PAGER-more}
+	gzip -cdfq | eval more
     fi
 else
     FIRST=1
@@ -62,7 +62,7 @@
 	fi
 	if test "$ANS" != 's'; then
 		echo "------> $FILE <------"
-		gzip -cdfq "$FILE" | eval ${PAGER-more}
+		gzip -cdfq "$FILE" | more
 	fi
 	if test -t 1; then
 		FIRST=0
--- gzip-1.3.5.orig/znew.in
+++ gzip-1.3.5/znew.in
@@ -16,8 +16,8 @@
 warn="(does not preserve modes and timestamp)"
 tmp=/tmp/zfoo.$$
 set -C
-echo hi > $tmp.1
-echo hi > $tmp.2
+echo hi > $tmp.1 || exit 1
+echo hi > $tmp.2 || exit 1
 if test -z "`(${CPMOD-cpmod} $tmp.1 $tmp.2) 2>&1`"; then
   cpmod=${CPMOD-cpmod}
   warn=""