aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2006-01-14 16:18:30 +0000
committerPeter Eisentraut <peter_e@gmx.net>2006-01-14 16:18:30 +0000
commit9d570f7e21ff2b0b34a62f68292142187aef86ed (patch)
tree4f19b61d6fb34944c32f9a285c1ee2071b59cb13
parentb0b8bab5755aeadea010eff3df4db51a99df38dc (diff)
downloadpostgresql-9d570f7e21ff2b0b34a62f68292142187aef86ed.tar.gz
postgresql-9d570f7e21ff2b0b34a62f68292142187aef86ed.zip
Fix pg_ctl crash on "unregister" when a data directory is not specified.
by Magnus Hagander
-rw-r--r--src/bin/pg_ctl/pg_ctl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 9ac22e28b22..5aa96f8865f 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.53.4.2 2005/05/04 22:35:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.53.4.3 2006/01/14 16:18:30 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1518,10 +1518,13 @@ main(int argc, char **argv)
do_wait = false;
}
- snprintf(def_postopts_file, MAXPGPATH, "%s/postmaster.opts.default", pg_data);
- snprintf(postopts_file, MAXPGPATH, "%s/postmaster.opts", pg_data);
- snprintf(pid_file, MAXPGPATH, "%s/postmaster.pid", pg_data);
- snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);
+ if (pg_data != NULL)
+ {
+ snprintf(def_postopts_file, MAXPGPATH, "%s/postmaster.opts.default", pg_data);
+ snprintf(postopts_file, MAXPGPATH, "%s/postmaster.opts", pg_data);
+ snprintf(pid_file, MAXPGPATH, "%s/postmaster.pid", pg_data);
+ snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);
+ }
switch (ctl_command)
{