summaryrefslogtreecommitdiff
blob: 08eeea1b21c5aa609b9ea2c50d9953a4c8f093df (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
--- gzexe.in.orig	2004-06-23 05:36:22.000000000 -0400
+++ gzexe.in	2004-06-23 05:53:53.000000000 -0400
@@ -114,22 +114,23 @@
   if test $decomp -eq 0; then
     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" | /bin/gzip -cd > /tmp/gztmp$$; then
+tmpfile=`tempfile -d /tmp -p gztmp` || 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