Create configure temporary files in a secure way
authorGabriele Giacone <1o5g4r8o@gmail.com>
Mon, 3 Jan 2011 16:55:51 +0000 (17:55 +0100)
committerGabriele Giacone <1o5g4r8o@gmail.com>
Tue, 4 Jan 2011 04:22:33 +0000 (05:22 +0100)
configure.ac

index 08d217b..85e19da 100644 (file)
@@ -3021,9 +3021,14 @@ cygnal/testsuite/cygnal.all/Makefile
 ########################## Final report begins... ############################
 ###
 
-cerr=/tmp/gnash-configure-errors.$$
-cwarn=/tmp/gnash-configure-warnings.$$
-crec=/tmp/gnash-configure-recommended.$$
+dnl Create temporary directory in a secure way
+tmp=`mktemp -d ${TMPDIR=/tmp}/gnash-configure-XXXXXX`
+if test \! -n "$tmp" || test \! -d "$tmp"; then
+  tmp=`(umask 077 && mkdir -d ${TMPDIR=/tmp}/gnash-configure-${RANDOM}-$$) 2>/dev/null`
+fi
+cerr=${tmp}/errors
+cwarn=${tmp}/warnings
+crec=${tmp}/recommended
 echo ""
 
 #trap 'rm cerr' 0 # trap isn't a good idea, might override other traps
@@ -4051,6 +4056,7 @@ else
   rm $cerr
 fi
 
+rmdir $tmp
 
 if test x"$fork" = x"no"; then
   AC_MSG_ERROR([Currently only forking the standalone player works!])