gzip/gzip-1.3.9-openbsd-owl-tmp.patch

68 lines
2.5 KiB
Diff
Raw Normal View History

2007-01-15 16:42:27 +00:00
--- gzip-1.3.9/znew.in.owl-tmp 2006-12-09 05:25:56.000000000 +0100
+++ gzip-1.3.9/znew.in 2007-01-15 11:40:51.000000000 +0100
@@ -55,28 +55,27 @@
# block is the disk block size (best guess, need not be exact)
warn="(does not preserve modes and timestamp)"
-tmp=/tmp/zfoo.$$
-set -C
-echo hi > $tmp || exit
-if test -z "`(${CPMOD-cpmod} $tmp $tmp) 2>&1`"; then
- cpmod=${CPMOD-cpmod}
+cpmod=
+cpmodarg=
+if type ${CPMOD:-cpmod} 2>/dev/null; then
+ cpmod=${CPMOD:-cpmod}
warn=""
fi
-if test -z "$cpmod" && ${TOUCH-touch} -r $tmp $tmp 2>/dev/null; then
- cpmod="${TOUCH-touch}"
+if test -z "$cpmod"; then
+ cpmod=touch
cpmodarg="-r"
warn="(does not preserve file modes)"
fi
-# check if GZIP env. variable uses -S or --suffix
-gzip -q $tmp
-ext=`echo $tmp* | sed "s|$tmp||"`
-rm -f $tmp*
-if test -z "$ext"; then
- echo znew: error determining gzip extension
- exit 1
-fi
+case "$GZIP" in
+ *-S*) ext=`echo "$GZIP" | sed 's/^.*-S[[:space:]]*\([^[:space:]]*\).*$/\1/'`
+ ;;
+ *-suffix*) ext=`echo "$GZIP" | sed 's/^.*--suffix=\([^[:space:]]*\).*$/\1/'`
+ ;;
+ *) ext='.gz'
+ ;;
+esac
if test "$ext" = ".Z"; then
echo znew: cannot use .Z as gzip extension.
exit 1
--- gzip-1.3.9/zdiff.in.owl-tmp 2006-12-09 05:25:56.000000000 +0100
+++ gzip-1.3.9/zdiff.in 2007-01-15 11:40:51.000000000 +0100
@@ -58,13 +58,13 @@
case "$2" in
*[-.]gz* | *[-.][zZ] | *.t[ga]z)
F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'`
- set -C
- trap 'rm -f /tmp/"$F".$$; exit 2' HUP INT PIPE TERM 0
- gzip -cdfq -- "$2" > /tmp/"$F".$$ || exit
- gzip -cdfq -- "$1" | $comp $OPTIONS - /tmp/"$F".$$
+ TF=`/bin/mktemp ${TMPDIR:-/tmp}/"$F".XXXXXXXXXX` || exit 1
+ trap 'rm -f "$TF"; exit 2' EXIT HUP INT PIPE TERM
+ gzip -cdfq -- "$2" > "$TF" || exit
+ gzip -cdfq -- "$1" | $comp $OPTIONS - "$TF"
STAT="$?"
- /bin/rm -f /tmp/"$F".$$ || STAT=2
- trap - HUP INT PIPE TERM 0
+ rm -f "$TF" || STAT=2
+ trap - EXIT HUP INT PIPE TERM
exit $STAT;;
*) gzip -cdfq -- "$1" | $comp $OPTIONS - "$2";;