Skip to content

Commit 7930e62

Browse files
committed
Fix pg_ctl crash on "unregister" when a data directory is not specified.
by Magnus Hagander
1 parent 34f8ee9 commit 7930e62

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/bin/pg_ctl/pg_ctl.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.63 2006/01/05 03:01:37 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.64 2006/01/14 15:41:28 petere Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -1519,10 +1519,13 @@ main(int argc, char **argv)
15191519
do_wait = false;
15201520
}
15211521

1522-
snprintf(def_postopts_file, MAXPGPATH, "%s/postmaster.opts.default", pg_data);
1523-
snprintf(postopts_file, MAXPGPATH, "%s/postmaster.opts", pg_data);
1524-
snprintf(pid_file, MAXPGPATH, "%s/postmaster.pid", pg_data);
1525-
snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);
1522+
if (pg_data)
1523+
{
1524+
snprintf(def_postopts_file, MAXPGPATH, "%s/postmaster.opts.default", pg_data);
1525+
snprintf(postopts_file, MAXPGPATH, "%s/postmaster.opts", pg_data);
1526+
snprintf(pid_file, MAXPGPATH, "%s/postmaster.pid", pg_data);
1527+
snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);
1528+
}
15261529

15271530
switch (ctl_command)
15281531
{

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