$NetBSD: patch-aa,v 1.5 2009/10/03 11:43:49 is Exp $ --- fax/faxspool.in.orig 2007-01-19 08:38:22.000000000 +0100 +++ fax/faxspool.in @@ -407,11 +407,11 @@ fs_cvt_pdf() # user name (for fax header only! auth is done by faxq-helper via getuid()) ########## -if user=`logname 2>/dev/null` -then : +if [ `id -u` = 0 ]; then + user=root else id=`id` - user=`expr "$id" : "[^( ]*(\([^)]*\)"` + user=`logname` fi test -z "$user" && user=$LOGNAME test -z "$user" && user=$USER @@ -653,12 +653,14 @@ fi # # mkdir a directory in $TMP (or /tmp), convert input to G3 in there # -spooldir=${TMP:-/tmp}/$new_seq.$$.`date +%S` +spooldirprefix=$new_seq.$$.`date +%S` +spooldir=`mktemp -d -t $spooldirprefix` -if ( umask 077 ; mkdir $spooldir ) ; then - $echo "spooling to $spooldir (->$new_seq)..." -else +if [ $? -ne 0 ] +then $echo "ERROR: can't create work dir '$spooldir', giving up" >&2 ; exit 6 +else + $echo "spooling to $spooldir (->$new_seq)..." fi # @@ -675,9 +677,9 @@ do if [ x$file = x- ] then $echo "spooling $file (stdin)..." - trap "rm /tmp/faxsp.$$" 0 - cat - >/tmp/faxsp.$$ - file=/tmp/faxsp.$$ + file=`mktemp -t faxsp.$$` + trap "rm $file" 0 + cat - > $file else $echo "spooling $file..." fi