]> granicus.if.org Git - php/commitdiff
security check and disclaimer for generated files
authorSascha Schumann <sas@php.net>
Sat, 24 Apr 1999 22:16:06 +0000 (22:16 +0000)
committerSascha Schumann <sas@php.net>
Sat, 24 Apr 1999 22:16:06 +0000 (22:16 +0000)
scripts/preconfig

index a1af801e8b5ab8761de42db2b5cc1a8797012d7b..d088de5a57b6ce4dabc24e8fb3c2ffcd7257ef20 100755 (executable)
@@ -2,8 +2,17 @@
 #
 # $Id$
 
+disclaimer="Do NOT edit - this file is generated by preconfig"
+
+# security check - simply overwriting existing files could be harmful
+if test -e configure.in.new || test -e acconfig.h.new ; then
+       echo "Please remove the *.new files and rerun this command"
+       exit 1
+fi
+
 makefiles=`echo ext/*/Makefile.am | sed -e 's/\.am//g'`
-sed -e "s#@@EXT_MAKEFILES@@#$makefiles#" configure.in.in > configure.in.new
+echo "dnl $disclaimer" > configure.in.new
+sed -e "s#@@EXT_MAKEFILES@@#$makefiles#" configure.in.in >> configure.in.new
 cmp configure.in configure.in.new > /dev/null 2>&1
 if test $? -ne 0 ; then
     mv configure.in.new configure.in
@@ -11,7 +20,8 @@ else
     rm -f configure.in.new
 fi
 
-cat acconfig.h.in > acconfig.h.new
+echo "/* $disclaimer */" > acconfig.h.new
+cat acconfig.h.in >> acconfig.h.new
 confighfiles=`echo ext/*/config.h.stub`
 if test "$confighfiles" != "ext/*/config.h.stub"; then
     for file in $confighfiles; do