]> granicus.if.org Git - postgresql/commitdiff
Don't use a temp file. It was created insecurely and was easy to do without.
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 23 Jun 2001 23:29:48 +0000 (23:29 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 23 Jun 2001 23:29:48 +0000 (23:29 +0000)
src/bin/initdb/initdb.sh

index ffb2dc50e081123f77e2266074a9808580ee7ad3..42dea03a24227a6b7f4584ea3362070233d42872 100644 (file)
@@ -27,7 +27,7 @@
 # Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.128 2001/06/22 19:16:23 wieck Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.129 2001/06/23 23:29:48 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -45,8 +45,6 @@ exit_nicely(){
             echo "Removing $PGDATA." 1>&2
             rm -rf "$PGDATA" || echo "Failed." 1>&2
         fi
-        echo "Removing temp file $TEMPFILE." 1>&2
-        rm -rf "$TEMPFILE" || echo "Failed." 1>&2
     else
         echo "Data directory $PGDATA will not be removed at user's request." 1>&2
     fi
@@ -65,12 +63,6 @@ datadir='@datadir@'
 # as set by configure --enable-multibyte[=XXX].
 MULTIBYTE='@MULTIBYTE@'
 
-if [ "$TMPDIR" ]; then
-    TEMPFILE="$TMPDIR/initdb.$$"
-else
-    TEMPFILE="/tmp/initdb.$$"
-fi
-
 
 # Check for echo -n vs echo \c
 if echo '\c' | grep -s c >/dev/null 2>&1
@@ -353,7 +345,7 @@ if [ "$show_setting" = yes ] || [ "$debug" = yes ]
 then
     echo
     echo "Initdb variables:"
-    for var in PGDATA datadir PGPATH TEMPFILE MULTIBYTE MULTIBYTEID \
+    for var in PGDATA datadir PGPATH MULTIBYTE MULTIBYTEID \
         POSTGRES_SUPERUSERNAME POSTGRES_SUPERUSERID POSTGRES_BKI \
         POSTGRES_DESCR POSTGRESQL_CONF_SAMPLE \
        PG_HBA_SAMPLE PG_IDENT_SAMPLE ; do
@@ -807,12 +799,11 @@ echo "CREATE VIEW pg_stat_database AS \
         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
 
 echo "Loading pg_description."
-echo "COPY pg_description FROM STDIN" > $TEMPFILE
-cat "$POSTGRES_DESCR" >> $TEMPFILE
-
-cat $TEMPFILE \
+(
+  echo "COPY pg_description FROM STDIN;";
+  cat "$POSTGRES_DESCR"
+) \
        | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
-rm -f "$TEMPFILE" || exit_nicely
 
 echo "Setting lastsysoid."
 echo "UPDATE pg_database SET \