fi
# security
-if ! TMPDIR=`mktemp -d /tmp/.faxaddmodem.XXXXXX/`; then
+TMPDIR=`(mktemp -d /tmp/.faxaddmodem.XXXXXX) 2>/dev/null`
+if test X$TMPDIR = X; then
TMPDIR=/tmp/.faxaddmodem$$
- umask 077
- mkdir $TMPDIR || exit 1
fi
+@RM@ -rf $TMPDIR
+(umask 077 ; mkdir $TMPDIR) || exit 1
SH=$SCRIPT_SH # shell for use below
CPATH=$SPOOL/etc/config # prefix of configuration file
#
JUNK="etc/setup.tmp"
- trap "$RM \$JUNK; exit 1" 1 2 15
+ trap "$RM \$JUNK; $RM -r \$TMPDIR; exit 1" 1 2 15
exec 5>etc/setup.tmp
echo '# Warning, this file was automatically generated by faxsetup' >&5
echo "No scheduler config file exists, creating one from scratch."
ok=prompt # prompt for parameters
- PROMPTS=/tmp/faxpr$$
+ TMPDIR=`(mktemp -d /tmp/.faxsetup.XXXXXX) 2>/dev/null`
+ if test x$TMPDIR = x; then
+ TMPDIR=/tmp/.faxsetup$$
+ fi
+ $RM -rf $TMPDIR
+ (umask 077 ; mkdir $TMPDIR) || exit 1
+ PROMPTS=$TMPDIR/faxpr$$
JUNK="$JUNK $PROMPTS"
$RM -rf $PROMPTS
if onServer; then
$RM $JUNK
+ $RM -r $TMPDIR
fi
exit 0
. $SPOOL/etc/setup.cache # common configuration stuff
. $SPOOL/etc/setup.modem # modem-specific stuff
-SH=$SCRIPT_SH # shell for use below
-if ! TMPDIR=`mktemp -d /tmp/.probemodem.XXXXXX`; then
- TMPDIR=/tmp/.probemodem.sh$$
- mkdir $TMPDIR || exit 1
+TMPDIR=`(mktemp -d /tmp/.probemodem.XXXXXX) 2>/dev/null`
+if test X$TMPDIR = X; then
+ TMPDIR=/tmp/.probemodem$$
fi
+@RM@ -fr $TMPDIR
+(umask 077 ; mkdir $TMPDIR) || exit 1
+
+SH=$SCRIPT_SH # shell for use below
OUT=$TMPDIR/probemodem$$ # temp file in which modem output is recorded
SVR4UULCKN=$LIBEXEC/lockname # SVR4 UUCP lock name construction program
ONDELAY=$LIBEXEC/ondelay # prgm to open devices blocking on carrier
CAT="$CAT -u" # something to do unbuffered reads and writes
-# security
-${NOCLOBBER_ON}
-> $OUT || exit 1
-${NOCLOBBER_OFF}
-
while [ -z "$TTY" -o ! -c /dev/$TTY ]; do
if [ "$TTY" != "" ]; then
echo "/dev/$TTY is not a terminal device."
# Lock the device for later use when deducing the modem type.
#
JUNK="$LOCKX $OUT"
-trap "rm -f $JUNK; exit 1" 0 1 2 15
+trap "@RM@ -f $JUNK; @RM@ -fr $TMPDIR; exit 1" 0 1 2 15
LOCKSTR=`expr " $$" : '.*\(..........\)'`
# lock the device by all of its names
echo ""
echo "Hmm, something seems to be hung, check your modem eh?"
done)& nagpid=$!
- trap "rm -f \$JUNK; kill $nagpid \$catpid; exit 1" 0 1 2 15
+ trap "@RM@ -f \$JUNK; @RM@ -fr $TMPDIR; kill $nagpid \$catpid; exit 1" 0 1 2 15
if [ x"$ATCMD" != x"" ]; then
SendToModem "$ATCMD"
wait $nagpid # Really waits its end
exec 2>&3 3>&- # Restore stderr
- trap "rm -f \$JUNK; test \"\$catpid\" && kill \$catpid; exit 1" 0 1 2 15
+ trap "@RM@ -f \$JUNK; @RM@ -fr $TMPDIR; test \"\$catpid\" && kill \$catpid; exit 1" 0 1 2 15
sleep 1
RESULT=`tr -ds '\015' '\012' < $OUT | $SED -n '$p'`
UPDATE="date +'%D %H:%M' >$LAST"
# security
-if ! TMPDIR=`mktemp -d /tmp/.faxcron.XXXXXX`; then
- TMPDIR=/tmp/.faxcron.sh$$
- mkdir $TMPDIR || exit 1
+TMPDIR=`(mktemp -d /tmp/.faxcron.XXXXXX) 2>/dev/null`
+if test X$TMPDIR = X; then
+ TMPDIR=/tmp/.faxcron$$
fi
+@RM@ -fr $TMPDIR
+(umask 077 ; mkdir $TMPDIR) || exit 1
JUNK=$TMPDIR/faxjunk$$ # temp file used multiple times
AWKTMP=$TMPDIR/faxawk$$ # temp file for awk program
#
# Generate an awk program to process the statistics file.
#
-if ! TMPDIR=`mktemp -d /tmp/.recvstats.XXXXXX`; then
- TMPDIR=/tmp/.recvstats.sh$$
- mkdir $TMPDIR || exit 1
+TMPDIR=`(mktemp -d /tmp/.recvstats.XXXXXX) 2>/dev/null`
+if test X$TMPDIR = X; then
+ TMPDIR=/tmp/.recvstats$$
fi
-
-tmpAwk=$TMPDIR/faxawk$$ # temp file for awk program
-
-trap "rm -rf $TMPDIR; exit 1" 0 1 2 15
+@RM@ -fr $TMPDIR
+(umask 077 ; mkdir $TMPDIR) || exit 1
+tmpAwk=$TMPDIR/xferfax$$
+trap "@RM@ -f $tmpAwk; @RM@ -fr $TMPDIR; exit 1" 0 1 2 15
($CAT<<'EOF'
#
#
# Generate an awk program to process the statistics file.
#
-# security
-if ! TMPDIR=`mktemp -d /tmp/.xferfaxstats.XXXXXX`; then
- TMPDIR=/tmp/.xferfaxstats.sh$$
- mkdir $TMPDIR || exit 1
+TMPDIR=`(mktemp -d /tmp/.xferfaxstats.XXXXXX) 2>/dev/null`
+if test X$TMPDIR = X; then
+ TMPDIR=/tmp/.xferfaxstats$$
fi
-
-tmpAwk=$TMPDIR/faxawk$$ # temp file for awk program
-
-trap "rm -rf $TMPDIR; exit 1" 0 1 2 15
+@RM@ -fr $TMPDIR
+(umask 077 ; mkdir $TMPDIR) || exit 1
+tmpAwk=$TMPDIR/xferfax$$
+trap "@RM@ -fr $TMPDIR; exit 1" 0 1 2 15
($CAT<<'EOF'
#