Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaea3283

Browse files
committed
Don't use a temp file. It was created insecurely and was easy to do without.
1 parentf1423cd commitaea3283

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

‎src/bin/initdb/initdb.sh

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
2828
# Portions Copyright (c) 1994, Regents of the University of California
2929
#
30-
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.128 2001/06/22 19:16:23 wieck Exp $
30+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.129 2001/06/23 23:29:48 petere Exp $
3131
#
3232
#-------------------------------------------------------------------------
3333

@@ -45,8 +45,6 @@ exit_nicely(){
4545
echo"Removing$PGDATA."1>&2
4646
rm -rf"$PGDATA"||echo"Failed."1>&2
4747
fi
48-
echo"Removing temp file$TEMPFILE."1>&2
49-
rm -rf"$TEMPFILE"||echo"Failed."1>&2
5048
else
5149
echo"Data directory$PGDATA will not be removed at user's request."1>&2
5250
fi
@@ -65,12 +63,6 @@ datadir='@datadir@'
6563
# as set by configure --enable-multibyte[=XXX].
6664
MULTIBYTE='@MULTIBYTE@'
6765

68-
if ["$TMPDIR" ];then
69-
TEMPFILE="$TMPDIR/initdb.$$"
70-
else
71-
TEMPFILE="/tmp/initdb.$$"
72-
fi
73-
7466

7567
# Check for echo -n vs echo \c
7668
ifecho'\c'| grep -s c>/dev/null2>&1
@@ -353,7 +345,7 @@ if [ "$show_setting" = yes ] || [ "$debug" = yes ]
353345
then
354346
echo
355347
echo"Initdb variables:"
356-
forvarin PGDATA datadir PGPATHTEMPFILEMULTIBYTE MULTIBYTEID \
348+
forvarin PGDATA datadir PGPATH MULTIBYTE MULTIBYTEID \
357349
POSTGRES_SUPERUSERNAME POSTGRES_SUPERUSERID POSTGRES_BKI \
358350
POSTGRES_DESCR POSTGRESQL_CONF_SAMPLE \
359351
PG_HBA_SAMPLE PG_IDENT_SAMPLE;do
@@ -807,12 +799,11 @@ echo "CREATE VIEW pg_stat_database AS \
807799
|"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
808800

809801
echo"Loading pg_description."
810-
echo"COPY pg_description FROM STDIN">$TEMPFILE
811-
cat"$POSTGRES_DESCR">>$TEMPFILE
812-
813-
cat$TEMPFILE \
802+
(
803+
echo"COPY pg_description FROM STDIN;";
804+
cat"$POSTGRES_DESCR"
805+
) \
814806
|"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
815-
rm -f"$TEMPFILE"|| exit_nicely
816807

817808
echo"Setting lastsysoid."
818809
echo"UPDATE pg_database SET\

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp