summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-09-27 20:10:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-09-27 20:10:30 +0000
commit29adbbd769407fd1bbca34b38a68a6fd94fbf059 (patch)
tree398929c70a7577b90eb54010040137e71dda7622
parentf2ead72cfe10028491b4941c0942a12d089532fa (diff)
If first mktemp succeeds and second fails, be sure to remove the first temp file before exiting
-rw-r--r--gnu/usr.bin/gzip/gzexe8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/usr.bin/gzip/gzexe b/gnu/usr.bin/gzip/gzexe
index 6b0f17d497f..5b5b9943117 100644
--- a/gnu/usr.bin/gzip/gzexe
+++ b/gnu/usr.bin/gzip/gzexe
@@ -12,7 +12,7 @@
# The : is required for some old versions of csh.
# On Ultrix, /bin/sh is too buggy, change the first line to: #!/bin/sh5
#
-# $OpenBSD: gzexe,v 1.3 1997/08/11 17:52:02 millert Exp $
+# $OpenBSD: gzexe,v 1.4 2001/09/27 20:10:29 millert Exp $
x=`basename $0`
if test $# = 0; then
@@ -34,7 +34,11 @@ if test "x$1" = "x-d"; then
fi
zfoo1=`/usr/bin/mktemp zfoo1XXXXXXXXXX` || exit 1
-zfoo2=`/usr/bin/mktemp zfoo2XXXXXXXXXX` || exit 1
+zfoo2=`/usr/bin/mktemp zfoo2XXXXXXXXXX`
+if [ $? -ne 0 ]; then
+ rm -f $zfoo1
+ exit 1
+fi
echo hi > $zfoo1
echo hi > $zfoo2
if test -z "`(${CPMOD-cpmod} $zfoo1 $zfoo2) 2>&1`"; then