1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Fix pg_ctl crash on "unregister" when a data directory is not specified.

by Magnus Hagander
This commit is contained in:
Peter Eisentraut
2006-01-14 16:18:30 +00:00
parent b0b8bab575
commit 9d570f7e21

View File

@@ -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)
{