aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2006-01-14 16:16:08 +0000
committerPeter Eisentraut <peter_e@gmx.net>2006-01-14 16:16:08 +0000
commit5032245807613b74b638f9b9c742756762000723 (patch)
tree7e28f16e59fae475245fb1f4ef7d12e9ab7cfb86
parent5dc3d1b0be55314dd79dcc2b761389ca805b36f4 (diff)
downloadpostgresql-5032245807613b74b638f9b9c742756762000723.tar.gz
postgresql-5032245807613b74b638f9b9c742756762000723.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 79e3b11da4d..7e5c3f59065 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.61.2.1 2005/11/22 18:23:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.61.2.2 2006/01/14 16:16:08 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1521,10 +1521,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)
{