Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+8-5
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)