summaryrefslogtreecommitdiff
path: root/usr.bin/mkdep
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-16 01:20:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-16 01:20:04 +0000
commitd526f90f06066e8ca43548a6b114260f02d6e314 (patch)
treefa58ce10954941af2155839a4e48f6e414593eff /usr.bin/mkdep
parentc4f335adba92b5d6ba3fa116fef9983a2e1190c0 (diff)
kill the race; spotted by bitblt
Diffstat (limited to 'usr.bin/mkdep')
-rw-r--r--usr.bin/mkdep/mkdep.append16
-rw-r--r--usr.bin/mkdep/mkdep.gcc.sh18
-rw-r--r--usr.bin/mkdep/mkdep.old.compiler16
-rw-r--r--usr.bin/mkdep/mkdep.sh18
-rw-r--r--usr.bin/mkdep/mkdep.ultrix16
5 files changed, 62 insertions, 22 deletions
diff --git a/usr.bin/mkdep/mkdep.append b/usr.bin/mkdep/mkdep.append
index e541fa30941..44da8b5d1e4 100644
--- a/usr.bin/mkdep/mkdep.append
+++ b/usr.bin/mkdep/mkdep.append
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: mkdep.append,v 1.2 1996/06/26 05:37:07 deraadt Exp $
+# $OpenBSD: mkdep.append,v 1.3 1996/09/16 01:20:02 deraadt Exp $
# $NetBSD: mkdep.append,v 1.2 1994/12/23 07:34:57 jtc Exp $
#
# Copyright (c) 1991, 1993
@@ -69,9 +69,17 @@ if [ ! -w $MAKE ]; then
exit 1
fi
-TMP=/tmp/mkdep$$
+DTMP=/tmp/_mkdep$$
+TMP=$DTMP/mkdep
-trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+um=`umask`
+umask 022
+if ! mkdir $DTMP ; then
+ echo failed to create tmp dir $DTMP
+ exit 1
+fi
+umask $um
+trap 'rm -rf $DTMP ; exit 1' 1 2 3 13 15
cp $MAKE ${MAKE}.bak
@@ -122,5 +130,5 @@ _EOF_
# copy to preserve permissions
cp $TMP $MAKE
-rm -f ${MAKE}.bak $TMP
+rm -rf ${MAKE}.bak $DTMP
exit 0
diff --git a/usr.bin/mkdep/mkdep.gcc.sh b/usr.bin/mkdep/mkdep.gcc.sh
index 64df4a00b0d..21149f6e726 100644
--- a/usr.bin/mkdep/mkdep.gcc.sh
+++ b/usr.bin/mkdep/mkdep.gcc.sh
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: mkdep.gcc.sh,v 1.2 1996/06/26 05:37:07 deraadt Exp $
+# $OpenBSD: mkdep.gcc.sh,v 1.3 1996/09/16 01:20:02 deraadt Exp $
# $NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $
#
# Copyright (c) 1991, 1993
@@ -71,9 +71,17 @@ if [ $# = 0 ] ; then
exit 1
fi
-TMP=/tmp/mkdep$$
+DTMP=/tmp/mkdep$$
+TMP=$DTMP/mkdep
-trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+um=`umask`
+umask 022
+if ! mkdir $DTMP ; then
+ echo failed to create tmp dir $DTMP
+ exit 1
+fi
+umask $um
+trap 'rm -rf $DTMP ; exit 1' 1 2 3 13 15
if [ x$pflag = x ]; then
gcc -M "$@" | sed -e 's; \./; ;g' > $TMP
@@ -83,13 +91,13 @@ fi
if [ $? != 0 ]; then
echo 'mkdep: compile failed.'
- rm -f $TMP
+ rm -rf $DTMP
exit 1
fi
if [ $append = 1 ]; then
cat $TMP >> $D
- rm -f $TMP
+ rm -rf $DTMP
else
mv $TMP $D
fi
diff --git a/usr.bin/mkdep/mkdep.old.compiler b/usr.bin/mkdep/mkdep.old.compiler
index 285bd4adf6b..2d007c64129 100644
--- a/usr.bin/mkdep/mkdep.old.compiler
+++ b/usr.bin/mkdep/mkdep.old.compiler
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: mkdep.old.compiler,v 1.2 1996/06/26 05:37:08 deraadt Exp $
+# $OpenBSD: mkdep.old.compiler,v 1.3 1996/09/16 01:20:02 deraadt Exp $
# $NetBSD: mkdep.old.compiler,v 1.2 1994/12/23 07:35:00 jtc Exp $
#
# Copyright (c) 1991, 1993
@@ -72,9 +72,17 @@ if [ ! -w $MAKE ]; then
exit 1
fi
-TMP=/tmp/mkdep$$
+DTMP=/tmp/_mkdep$$
+TMP=$DTMP/mkdep
-trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+um=`umask`
+umask 022
+if ! mkdir $DTMP ; then
+ echo failed to create tmp dir $DTMP
+ exit 1
+fi
+umask $um
+trap 'rm -rf $DTMP ; exit 1' 1 2 3 13 15
cp $MAKE ${MAKE}.bak
sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
@@ -142,5 +150,5 @@ _EOF_
# copy to preserve permissions
cp $TMP $MAKE
-rm -f $TMP
+rm -rf $DTMP
exit 0
diff --git a/usr.bin/mkdep/mkdep.sh b/usr.bin/mkdep/mkdep.sh
index b9505e195e8..302d5310be6 100644
--- a/usr.bin/mkdep/mkdep.sh
+++ b/usr.bin/mkdep/mkdep.sh
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: mkdep.sh,v 1.2 1996/06/26 05:37:08 deraadt Exp $
+# $OpenBSD: mkdep.sh,v 1.3 1996/09/16 01:20:03 deraadt Exp $
# $NetBSD: mkdep.sh,v 1.3 1994/12/23 07:35:02 jtc Exp $
#
# Copyright (c) 1991, 1993
@@ -70,9 +70,17 @@ if [ $# = 0 ] ; then
exit 1
fi
-TMP=/tmp/mkdep$$
+DTMP=/tmp/_mkdep$$
+TMP=$DTMP/mkdep
-trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+um=`umask`
+umask 022
+if ! mkdir $DTMP ; then
+ echo failed to create tmp dir $DTMP
+ exit 1
+fi
+umask $um
+trap 'rm -rf $DTMP ; exit 1' 1 2 3 13 15
cc -M $* |
sed "
@@ -101,13 +109,13 @@ END {
if [ $? != 0 ]; then
echo 'mkdep: compile failed.'
- rm -f $TMP
+ rm -rf $DTMP
exit 1
fi
if [ $append = 1 ]; then
cat $TMP >> $D
- rm -f $TMP
+ rm -rf $DTMP
else
mv $TMP $D
fi
diff --git a/usr.bin/mkdep/mkdep.ultrix b/usr.bin/mkdep/mkdep.ultrix
index c9e126867b0..b908bd2697f 100644
--- a/usr.bin/mkdep/mkdep.ultrix
+++ b/usr.bin/mkdep/mkdep.ultrix
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: mkdep.ultrix,v 1.2 1996/06/26 05:37:09 deraadt Exp $
+# $OpenBSD: mkdep.ultrix,v 1.3 1996/09/16 01:20:03 deraadt Exp $
# $NetBSD: mkdep.ultrix,v 1.2 1994/12/23 07:35:04 jtc Exp $
#
# Copyright (c) 1991, 1993
@@ -69,9 +69,17 @@ if [ ! -w $MAKE ]; then
exit 1
fi
-TMP=/tmp/mkdep$$
+DTMP=/tmp/_mkdep$$
+TMP=$DTMP/mkdep
-trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+um=`umask`
+umask 022
+if ! mkdir $DTMP ; then
+ echo failed to create tmp dir $DTMP
+ exit 1
+fi
+umask $um
+trap 'rm -rf $DTMP ; exit 1' 1 2 3 13 15
cp $MAKE ${MAKE}.bak
@@ -123,5 +131,5 @@ _EOF_
# copy to preserve permissions
cp $TMP $MAKE
-rm -f ${MAKE}.bak $TMP
+rm -rf ${MAKE}.bak $DTMP
exit 0