summaryrefslogtreecommitdiffstats
path: root/archive/gzip/patches/gzip-1.3.5-znew-tempfile-2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'archive/gzip/patches/gzip-1.3.5-znew-tempfile-2.patch')
-rw-r--r--archive/gzip/patches/gzip-1.3.5-znew-tempfile-2.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/archive/gzip/patches/gzip-1.3.5-znew-tempfile-2.patch b/archive/gzip/patches/gzip-1.3.5-znew-tempfile-2.patch
new file mode 100644
index 0000000000..334e6a134d
--- /dev/null
+++ b/archive/gzip/patches/gzip-1.3.5-znew-tempfile-2.patch
@@ -0,0 +1,73 @@
+--- znew.in.orig 2004-12-12 23:22:11.668680240 -0500
++++ znew.in 2004-12-12 23:23:48.827909792 -0500
+@@ -14,7 +14,7 @@
+ # block is the disk block size (best guess, need not be exact)
+
+ warn="(does not preserve modes and timestamp)"
+-tmp=/tmp/zfoo.$$
++tmp=`mktemp /tmp/zfoo.XXXXXX`
+ set -C
+ echo hi > $tmp.1 || exit 1
+ echo hi > $tmp.2 || exit 1
+@@ -77,6 +77,7 @@
+
+ for i do
+ n=`echo $i | sed 's/.Z$//'`
++ ntmp=`mktemp $n.XXXXXX`
+ if test ! -f "$n.Z" ; then
+ echo $n.Z not found
+ res=1; continue
+@@ -92,7 +93,7 @@
+ fi
+ else
+ if test $check -eq 1; then
+- if cp -p "$n.Z" "$n.$$" 2> /dev/null || cp "$n.Z" "$n.$$"; then
++ if cp -p "$n.Z" "$ntmp" 2> /dev/null || cp "$n.Z" "$ntmp"; then
+ :
+ else
+ echo cannot backup "$n.Z"
+@@ -102,7 +103,7 @@
+ if gzip -d "$n.Z"; then
+ :
+ else
+- test $check -eq 1 && mv "$n.$$" "$n.Z"
++ test $check -eq 1 && mv "$ntmp" "$n.Z"
+ echo error while uncompressing $n.Z
+ res=1; continue
+ fi
+@@ -110,7 +111,7 @@
+ :
+ else
+ if test $check -eq 1; then
+- mv "$n.$$" "$n.Z" && rm -f "$n"
++ mv "$ntmp" "$n.Z" && rm -f "$n"
+ echo error while recompressing $n
+ else
+ # compress $n (might be dangerous if disk full)
+@@ -125,7 +126,7 @@
+ if test $pipe -eq 1; then
+ rm -f "$n$ext"
+ elif test $check -eq 1; then
+- mv "$n.$$" "$n.Z" && rm -f "$n$ext"
++ mv "$ntmp" "$n.Z" && rm -f "$n$ext"
+ else
+ gzip -d "$n$ext" && compress "$n" && rm -f "$n$ext"
+ fi
+@@ -133,9 +134,9 @@
+
+ elif test $check -eq 1; then
+ if gzip -t "$n$ext" ; then
+- rm -f "$n.$$" "$n.Z"
++ rm -f "$ntmp" "$n.Z"
+ else
+- test $pipe -eq 0 && mv "$n.$$" "$n.Z"
++ test $pipe -eq 0 && mv "$ntmp" "$n.Z"
+ rm -f "$n$ext"
+ echo error while testing $n$ext, $n.Z unchanged
+ res=1; continue
+@@ -144,4 +145,5 @@
+ rm -f "$n.Z"
+ fi
+ done
++rm -f "$ntmp"
+ exit $res