From c8b46b3ee31d2a8fc903d559ad36f20a9849f0c3 Mon Sep 17 00:00:00 2001 From: Kris Kennaway Date: Wed, 22 Nov 2000 11:05:51 +0000 Subject: [PATCH] Use secure temporary filenames during build. Audited by: markm, cracauer --- bin/sh/mkbuiltins | 2 +- bin/sh/mktokens | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/sh/mkbuiltins b/bin/sh/mkbuiltins index 89f50d279b9..e53f2b3d569 100755 --- a/bin/sh/mkbuiltins +++ b/bin/sh/mkbuiltins @@ -37,7 +37,7 @@ # @(#)mkbuiltins 8.2 (Berkeley) 5/4/95 # $FreeBSD$ -temp=/tmp/ka$$ +temp=`/usr/bin/mktemp -t ka` havejobs=0 if grep '^#define JOBS[ ]*1' shell.h > /dev/null then havejobs=1 diff --git a/bin/sh/mktokens b/bin/sh/mktokens index 172bb23d496..8632dc138ee 100644 --- a/bin/sh/mktokens +++ b/bin/sh/mktokens @@ -41,7 +41,8 @@ # token marks the end of a list. The third column is the name to print in # error messages. -cat > /tmp/ka$$ <<\! +temp=`/usr/bin/mktemp -t ka` +cat > $temp <<\! TEOF 1 end of file TNL 0 newline TSEMI 0 ";" @@ -71,25 +72,25 @@ TCASE 0 "case" TESAC 1 "esac" TNOT 0 "!" ! -nl=`wc -l /tmp/ka$$` +nl=`wc -l $temp` exec > token.h -awk '{print "#define " $1 " " NR-1}' /tmp/ka$$ +awk '{print "#define " $1 " " NR-1}' $temp echo ' /* Array indicating which tokens mark the end of a list */ const char tokendlist[] = {' -awk '{print "\t" $2 ","}' /tmp/ka$$ +awk '{print "\t" $2 ","}' $temp echo '}; char *const tokname[] = {' sed -e 's/"/\\"/g' \ -e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \ - /tmp/ka$$ + $temp echo '}; ' -sed 's/"//g' /tmp/ka$$ | awk ' +sed 's/"//g' $temp | awk ' /TIF/{print "#define KWDOFFSET " NR-1; print ""; print "char *const parsekwd[] = {"} /TIF/,/neverfound/{print " \"" $3 "\","}' echo ' 0 };' -rm /tmp/ka$$ +rm $temp