Use secure temporary filenames during build.

Audited by:	markm, cracauer
This commit is contained in:
Kris Kennaway 2000-11-22 11:05:51 +00:00
parent 5616d3cc64
commit c8b46b3ee3
2 changed files with 9 additions and 8 deletions

View File

@ -37,7 +37,7 @@
# @(#)mkbuiltins 8.2 (Berkeley) 5/4/95 # @(#)mkbuiltins 8.2 (Berkeley) 5/4/95
# $FreeBSD$ # $FreeBSD$
temp=/tmp/ka$$ temp=`/usr/bin/mktemp -t ka`
havejobs=0 havejobs=0
if grep '^#define JOBS[ ]*1' shell.h > /dev/null if grep '^#define JOBS[ ]*1' shell.h > /dev/null
then havejobs=1 then havejobs=1

View File

@ -41,7 +41,8 @@
# token marks the end of a list. The third column is the name to print in # token marks the end of a list. The third column is the name to print in
# error messages. # error messages.
cat > /tmp/ka$$ <<\! temp=`/usr/bin/mktemp -t ka`
cat > $temp <<\!
TEOF 1 end of file TEOF 1 end of file
TNL 0 newline TNL 0 newline
TSEMI 0 ";" TSEMI 0 ";"
@ -71,25 +72,25 @@ TCASE 0 "case"
TESAC 1 "esac" TESAC 1 "esac"
TNOT 0 "!" TNOT 0 "!"
! !
nl=`wc -l /tmp/ka$$` nl=`wc -l $temp`
exec > token.h exec > token.h
awk '{print "#define " $1 " " NR-1}' /tmp/ka$$ awk '{print "#define " $1 " " NR-1}' $temp
echo ' echo '
/* Array indicating which tokens mark the end of a list */ /* Array indicating which tokens mark the end of a list */
const char tokendlist[] = {' const char tokendlist[] = {'
awk '{print "\t" $2 ","}' /tmp/ka$$ awk '{print "\t" $2 ","}' $temp
echo '}; echo '};
char *const tokname[] = {' char *const tokname[] = {'
sed -e 's/"/\\"/g' \ sed -e 's/"/\\"/g' \
-e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \ -e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \
/tmp/ka$$ $temp
echo '}; echo '};
' '
sed 's/"//g' /tmp/ka$$ | awk ' sed 's/"//g' $temp | awk '
/TIF/{print "#define KWDOFFSET " NR-1; print ""; print "char *const parsekwd[] = {"} /TIF/{print "#define KWDOFFSET " NR-1; print ""; print "char *const parsekwd[] = {"}
/TIF/,/neverfound/{print " \"" $3 "\","}' /TIF/,/neverfound/{print " \"" $3 "\","}'
echo ' 0 echo ' 0
};' };'
rm /tmp/ka$$ rm $temp