summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2001-06-29 01:33:24 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2001-06-29 01:33:24 +0000
commit12e3700c216e7f39fe4b49c1bcd4d377fef4d04b (patch)
tree0405a2f5bb8e8847e892688cb22b914aa48c7aec /usr.bin
parentd3428bba31b23c4f38690868f26375d01dfaddf5 (diff)
use mktemp for temporary files creation, remove unnecessary directory
usage, exit appropriately and adjust the trap statements; ok millert
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/lorder/lorder.sh20
1 files changed, 6 insertions, 14 deletions
diff --git a/usr.bin/lorder/lorder.sh b/usr.bin/lorder/lorder.sh
index fc936e44719..3d5a2517cfc 100644
--- a/usr.bin/lorder/lorder.sh
+++ b/usr.bin/lorder/lorder.sh
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $OpenBSD: lorder.sh,v 1.10 1999/05/21 01:24:04 espie Exp $
+# $OpenBSD: lorder.sh,v 1.11 2001/06/29 01:33:23 pvalchev Exp $
# $NetBSD: lorder.sh.gnm,v 1.3 1995/12/20 04:45:11 cgd Exp $
#
# Copyright (c) 1990, 1993
@@ -47,20 +47,12 @@ case $# in
esac
# temporary files
-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
+R=`mktemp /tmp/_referenceXXXXXX` || exit 1
+S=`mktemp /tmp/_symbolXXXXXX` || exit 1
# remove temporary files on HUP, INT, QUIT, PIPE, TERM
-trap "rm -rf $TDIR; trap 2 ; kill -2 $$" 1 2 3 13 15
+trap "rm -f $R $S; exit 0" 0
+trap "rm -f $R $S; exit 1" 1 2 3 13 15
# make sure files depend on themselves
for file in "$@"; do echo "$file $file" ; done
@@ -87,4 +79,4 @@ ${NM:-nm} -go "$@" | sed "
sort +1 $R -o $R
sort +1 $S -o $S
join -j 2 -o 1.1 2.1 $R $S
-rm -rf $TDIR
+rm -f $R $S