From: deraadt Date: Mon, 16 Sep 1996 01:16:27 +0000 (+0000) Subject: kill the race; spotted by bitblt X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=214a955b0fea073de87d5b5e4891456e7a9d4db2;p=openbsd kill the race; spotted by bitblt --- diff --git a/usr.bin/lorder/lorder.sh b/usr.bin/lorder/lorder.sh index c52a90ca12e..329fb841652 100644 --- a/usr.bin/lorder/lorder.sh +++ b/usr.bin/lorder/lorder.sh @@ -1,5 +1,5 @@ #!/bin/sh - -# $OpenBSD: lorder.sh,v 1.2 1996/06/26 05:36:09 deraadt Exp $ +# $OpenBSD: lorder.sh,v 1.3 1996/09/16 01:16:27 deraadt Exp $ # $NetBSD: lorder.sh,v 1.3 1995/04/24 07:38:52 cgd Exp $ # # Copyright (c) 1990, 1993 @@ -50,8 +50,17 @@ case $# in esac # temporary files -R=/tmp/_reference_$$ -S=/tmp/_symbol_$$ +TDIR=/tmp/_lorder$$ +R=$TDIR/reference +S=$TDIR/symbol + +um=`umask` +umask 022 +if ! mkdir $TDIR ; then + echo temporary directory exists $TDIR + exit 1 +fi +umask $um # remove temporary files on HUP, INT, QUIT, PIPE, TERM trap "rm -f $R $S; exit 1" 1 2 3 13 15 @@ -88,4 +97,4 @@ nm -go $* | sed " sort +1 $R -o $R sort +1 $S -o $S join -j 2 -o 1.1 2.1 $R $S -rm -f $R $S +rm -rf $TDIR diff --git a/usr.bin/lorder/lorder.sh.gnm b/usr.bin/lorder/lorder.sh.gnm index 2973fe2a017..e518882d409 100644 --- a/usr.bin/lorder/lorder.sh.gnm +++ b/usr.bin/lorder/lorder.sh.gnm @@ -1,5 +1,5 @@ #!/bin/sh - -# $OpenBSD: lorder.sh.gnm,v 1.4 1996/06/26 05:36:09 deraadt Exp $ +# $OpenBSD: lorder.sh.gnm,v 1.5 1996/09/16 01:16:27 deraadt Exp $ # $NetBSD: lorder.sh.gnm,v 1.3 1995/12/20 04:45:11 cgd Exp $ # # Copyright (c) 1990, 1993 @@ -50,11 +50,20 @@ case $# in esac # temporary files -R=/tmp/_reference_$$ -S=/tmp/_symbol_$$ +TDIR=/tmp/_lorder$$ +R=$TDIR/reference +S=$TDIR/symbol + +um=`umask` +umask 022 +if ! mkdir $TDIR ; then + echo temporary directory exists $TDIR + exit 1 +fi +umask $um # remove temporary files on HUP, INT, QUIT, PIPE, TERM -trap "rm -f $R $S; exit 1" 1 2 3 13 15 +trap "rm -rf $TDIR; exit 1" 1 2 3 13 15 # if the line ends in a colon, assume it's the first occurrence of a new # object file. Echo it twice, just to make sure it gets into the output. @@ -88,4 +97,4 @@ trap "rm -f $R $S; exit 1" 1 2 3 13 15 sort +1 $R -o $R sort +1 $S -o $S join -j 2 -o 1.1 2.1 $R $S -rm -f $R $S +rm -rf $TDIR 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