diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-20 06:47:06 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-20 06:47:06 +0000 |
commit | 3e157389bddfc8add3628918136862ef4a990d64 (patch) | |
tree | 6a3ad0b433001fc2519c8b3901926b8e0ffba5b0 /gnu | |
parent | 80ac73225a753264dc39c2ba66794f5bf1bf9a0f (diff) |
use mktemp(1)
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/sendbug/sendbug.sh | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/gnu/usr.bin/sendbug/sendbug.sh b/gnu/usr.bin/sendbug/sendbug.sh index 3e2ecab2c6c..28c2333982a 100644 --- a/gnu/usr.bin/sendbug/sendbug.sh +++ b/gnu/usr.bin/sendbug/sendbug.sh @@ -21,7 +21,7 @@ # along with GNU GNATS; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # -# $OpenBSD: sendbug.sh,v 1.9 1999/01/20 06:38:52 millert Exp $ +# $OpenBSD: sendbug.sh,v 1.10 1999/01/20 06:47:05 millert Exp $ # The version of this send-pr. VERSION=3.97 @@ -71,6 +71,15 @@ fi umask 077 +# Find a user name +if [ "$LOGNAME" = "" ]; then + if [ "$USER" != "" ]; then + LOGNAME="$USER" + else + LOGNAME="UNKNOWN" + fi +fi + # For '&' expansion in gecos TEMP=${LOGNAME} while test ${#TEMP} -gt 1; do @@ -119,18 +128,16 @@ else fi fi -TEMP=$TMPDIR/p$$ -BAD=$TMPDIR/pbad$$ -REF=$TMPDIR/pf$$ - -# find a user name -if [ "$LOGNAME" = "" ]; then - if [ "$USER" != "" ]; then - LOGNAME="$USER" - else - LOGNAME="UNKNOWN" - fi -fi +# Make temp files safely +TEMP=`mktemp $TMPDIR/p.XXXXXX` || exit 1 +BAD=`mktemp $TMPDIR/pbad.XXXXXX` || { + rm -f $TEMP + exit 1 +} +REF=`mktemp $TMPDIR/pf.XXXXXX` || { + rm -f $TEMP $BAD + exit 1 +} FROM="$LOGNAME" if [ -z "$REPLYTO" ]; then |