Skip to content

Commit 124c22d

Browse files
committed
Remove use of postmaster.opts.default by pg_ctl.
1 parent 5f6f840 commit 124c22d

File tree

2 files changed

+19
-44
lines changed

2 files changed

+19
-44
lines changed

doc/src/sgml/ref/pg_ctl-ref.sgml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.45 2008/04/23 13:44:58 mha Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.46 2008/06/26 01:12:19 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -405,20 +405,6 @@ PostgreSQL documentation
405405
</listitem>
406406
</varlistentry>
407407

408-
<varlistentry>
409-
<term><filename>postmaster.opts.default</filename></term>
410-
411-
<listitem>
412-
<para>
413-
If this file exists in the data directory,
414-
<application>pg_ctl</application> (in <option>start</option>
415-
mode) will pass the contents of the file as options to the
416-
<command>postgres</command> command, unless overridden by the
417-
<option>-o</option> option.
418-
</para>
419-
</listitem>
420-
</varlistentry>
421-
422408
<varlistentry>
423409
<term><filename>postmaster.opts</filename></term>
424410

src/bin/pg_ctl/pg_ctl.c

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.98 2008/04/24 14:23:43 mha Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.99 2008/06/26 01:12:20 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -140,7 +140,6 @@ static void read_post_opts(void);
140140
static bool test_postmaster_connection(bool);
141141
static bool postmaster_is_alive(pid_t pid);
142142

143-
static char def_postopts_file[MAXPGPATH];
144143
static char postopts_file[MAXPGPATH];
145144
static char pid_file[MAXPGPATH];
146145
static char conf_file[MAXPGPATH];
@@ -575,42 +574,35 @@ unlimit_core_size(void)
575574
static void
576575
read_post_opts(void)
577576
{
578-
char *optline = NULL;
579-
580577
if (post_opts == NULL)
581578
{
582579
char **optlines;
583-
int len;
584580

585-
optlines = readfile(ctl_command == RESTART_COMMAND ?
586-
postopts_file : def_postopts_file);
587-
if (optlines == NULL)
581+
post_opts = ""; /* defatult */
582+
if (ctl_command == RESTART_COMMAND)
588583
{
589-
if (ctl_command == START_COMMAND || ctl_command == RUN_AS_SERVICE_COMMAND)
590-
post_opts = "";
591-
else
584+
optlines = readfile(postopts_file);
585+
if (optlines == NULL)
592586
{
593587
write_stderr(_("%s: could not read file \"%s\"\n"), progname, postopts_file);
594588
exit(1);
595589
}
596-
}
597-
else if (optlines[0] == NULL || optlines[1] != NULL)
598-
{
599-
write_stderr(_("%s: option file \"%s\" must have exactly one line\n"),
600-
progname, ctl_command == RESTART_COMMAND ?
601-
postopts_file : def_postopts_file);
602-
exit(1);
603-
}
604-
else
605-
{
606-
optline = optlines[0];
607-
len = strcspn(optline, "\r\n");
608-
optline[len] = '\0';
609-
610-
if (ctl_command == RESTART_COMMAND)
590+
else if (optlines[0] == NULL || optlines[1] != NULL)
611591
{
592+
write_stderr(_("%s: option file \"%s\" must have exactly one line\n"),
593+
progname, postopts_file);
594+
exit(1);
595+
}
596+
else
597+
{
598+
int len;
599+
char *optline = NULL;
612600
char *arg1;
613601

602+
optline = optlines[0];
603+
len = strcspn(optline, "\r\n");
604+
optline[len] = '\0';
605+
614606
arg1 = strchr(optline, *SYSTEMQUOTE);
615607
if (arg1 == NULL || arg1 == optline)
616608
post_opts = "";
@@ -622,8 +614,6 @@ read_post_opts(void)
622614
if (postgres_path != NULL)
623615
postgres_path = optline;
624616
}
625-
else
626-
post_opts = optline;
627617
}
628618
}
629619
}
@@ -1894,7 +1884,6 @@ main(int argc, char **argv)
18941884

18951885
if (pg_data)
18961886
{
1897-
snprintf(def_postopts_file, MAXPGPATH, "%s/postmaster.opts.default", pg_data);
18981887
snprintf(postopts_file, MAXPGPATH, "%s/postmaster.opts", pg_data);
18991888
snprintf(pid_file, MAXPGPATH, "%s/postmaster.pid", pg_data);
19001889
snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);

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