Skip to content

Commit 9ae6819

Browse files
committed
Make sure that the postmaster options (from postmaster.opts[.default] or
-o option) are properly dequoted. Also, always pass an explicit -D option to postmaster, don't rely on it being set in postmaster.opts.
1 parent e6767a3 commit 9ae6819

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

src/bin/pg_ctl/pg_ctl.sh

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
#
1010
# IDENTIFICATION
11-
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.19 2001/03/18 20:27:11 tgl Exp $
11+
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.20 2001/04/21 11:23:58 petere Exp $
1212
#
1313
#-------------------------------------------------------------------------
1414

@@ -299,37 +299,33 @@ if [ $op = "start" -o $op = "restart" ];then
299299
oldpid=`sed -n 1p $PIDFILE`
300300
fi
301301

302-
unset logopt
303-
if [ -n "$logfile" ]; then
304-
logopt='</dev/null >>$logfile 2>&1'
305-
else
306-
# when starting without log file, redirect stderr to stdout, so
307-
# pg_ctl can be invoked with >$logfile and still have pg_ctl's
308-
# stderr on the terminal.
309-
logopt='</dev/null 2>&1'
310-
fi
311-
312302
# no -o given
313303
if [ -z "$POSTOPTS" ];then
314304
if [ $op = "start" ];then
315305
# if we are in start mode, then look for postmaster.opts.default
316306
if [ -f $DEFPOSTOPTS ]; then
317-
POSTOPTS=`cat $DEFPOSTOPTS`
307+
eval set X "`cat $DEFPOSTOPTS`"; shift
318308
fi
319-
POSTOPTS="-D $PGDATA $POSTOPTS"
320309
else
321310
# if we are in restart mode, then look for postmaster.opts
322-
set X `cat $POSTOPTSFILE`
323-
shift
311+
eval set X "`cat $POSTOPTSFILE`"; shift
324312
po_path=$1
325313
shift
326-
POSTOPTS=$@
327314
fi
328315
else # -o given
329-
POSTOPTS="-D $PGDATA $POSTOPTS"
316+
eval set X "$POSTOPTS"; shift
330317
fi
331318

332-
eval '$po_path' '$POSTOPTS' $logopt '&'
319+
set X -D "$PGDATA" ${1+"$@"}; shift
320+
321+
if [ -n "$logfile" ]; then
322+
"$po_path" "$@" </dev/null >>$logfile 2>&1 &
323+
else
324+
# when starting without log file, redirect stderr to stdout, so
325+
# pg_ctl can be invoked with >$logfile and still have pg_ctl's
326+
# stderr on the terminal.
327+
"$po_path" "$@" </dev/null 2>&1 &
328+
fi
333329

334330
# if had an old lockfile, check to see if we were able to start
335331
if [ -n "$oldpid" ];then

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy