diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-27 20:10:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-27 20:10:30 +0000 |
commit | 29adbbd769407fd1bbca34b38a68a6fd94fbf059 (patch) | |
tree | 398929c70a7577b90eb54010040137e71dda7622 /gnu | |
parent | f2ead72cfe10028491b4941c0942a12d089532fa (diff) |
If first mktemp succeeds and second fails, be sure to remove the first temp file before exiting
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/gzip/gzexe | 8 |
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 |