=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mktemp/mktemp.1,v retrieving revision 1.16 retrieving revision 1.17 diff -c -r1.16 -r1.17 *** src/usr.bin/mktemp/mktemp.1 2000/03/28 23:40:05 1.16 --- src/usr.bin/mktemp/mktemp.1 2000/06/26 02:43:31 1.17 *************** *** 1,4 **** ! .\" $OpenBSD: mktemp.1,v 1.16 2000/03/28 23:40:05 aaron Exp $ .\" .\" Copyright (c) 1996, 2000 Todd C. Miller .\" All rights reserved. --- 1,4 ---- ! .\" $OpenBSD: mktemp.1,v 1.17 2000/06/26 02:43:31 pjanzen Exp $ .\" .\" Copyright (c) 1996, 2000 Todd C. Miller .\" All rights reserved. *************** *** 121,135 **** where the script should quit if it cannot get a safe temporary file. .Bd -literal -offset indent ! TMPFILE=`mktemp /tmp/$0.XXXXXXXXXX` || exit 1 echo "program output" >> $TMPFILE .Ed .Pp In this case, we want the script to catch the error ourselves. .Bd -literal -offset indent ! TMPFILE=`mktemp -q /tmp/$0.XXXXXXXXXX` if [ $? -ne 0 ]; then ! echo "$0: Can't create temp file, exiting..." exit 1 fi .Ed --- 121,137 ---- where the script should quit if it cannot get a safe temporary file. .Bd -literal -offset indent ! CMD=`basename $0` ! TMPFILE=`mktemp /tmp/$CMD.XXXXXXXXXX` || exit 1 echo "program output" >> $TMPFILE .Ed .Pp In this case, we want the script to catch the error ourselves. .Bd -literal -offset indent ! CMD=`basename $0` ! TMPFILE=`mktemp -q /tmp/$CMD.XXXXXXXXXX` if [ $? -ne 0 ]; then ! echo "$CMD: Can't create temp file, exiting..." exit 1 fi .Ed *************** *** 139,145 **** is unable to create the file. In this case you can protect the part of the script thusly. .Bd -literal -offset indent ! TMPFILE=`mktemp /tmp/$0.XXXXXXXXXX` && { # Safe to use $TMPFILE in this block echo data > $TMPFILE ... --- 141,148 ---- is unable to create the file. In this case you can protect the part of the script thusly. .Bd -literal -offset indent ! CMD=`basename $0` ! TMPFILE=`mktemp /tmp/$CMD.XXXXXXXXXX` && { # Safe to use $TMPFILE in this block echo data > $TMPFILE ...