diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2006-01-14 15:41:28 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2006-01-14 15:41:28 +0000 |
commit | 7930e627d8aaf617f4edb8b9e4fe410cc475a93a (patch) | |
tree | d7362d6eaa8341a68f59d13cbb52c5f5ca021728 /src | |
parent | 34f8ee973742d6a72840184c15aff7718022fae7 (diff) | |
download | postgresql-7930e627d8aaf617f4edb8b9e4fe410cc475a93a.tar.gz postgresql-7930e627d8aaf617f4edb8b9e4fe410cc475a93a.zip |
Fix pg_ctl crash on "unregister" when a data directory is not specified.
by Magnus Hagander
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_ctl/pg_ctl.c | 13 |
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 02fe1852164..6a601ab83f3 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.63 2006/01/05 03:01:37 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.64 2006/01/14 15:41:28 petere Exp $ * *------------------------------------------------------------------------- */ @@ -1519,10 +1519,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) + { + 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) { |