From b721949a033185259c66fb20759afd7deb09631f Mon Sep 17 00:00:00 2001 From: kris Date: Thu, 2 Nov 2000 06:33:57 +0000 Subject: Don't use a trivially predictable temporary filename and keep recreating it again and again, practically begging the Bad Man to insert his symlink underneath it and send us down the path to oblivion. Noticed by: David Lary --- usr.sbin/periodic/periodic.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'usr.sbin/periodic') diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh index cd152d8..ce38ba2 100644 --- a/usr.sbin/periodic/periodic.sh +++ b/usr.sbin/periodic/periodic.sh @@ -27,7 +27,7 @@ fi host=`hostname` export host -tmp_output=${TMPDIR:-/tmp}/periodic.$$ +tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX` # Execute each executable file in the directory list. If the x bit is not # set, assume the user didn't really want us to muck with it (it's a @@ -89,9 +89,10 @@ do esac [ $output = TRUE ] && { cat $tmp_output; empty=FALSE; } fi - rm -f $tmp_output + cp /dev/null $tmp_output fi done + rm -f $tmp_output done if [ $empty = TRUE ] then -- cgit v1.1