From: Bruce Momjian Date: Fri, 27 Jun 2008 01:53:31 +0000 (+0000) Subject: Fix 'pg_ctl reload' to properly preserve postmaster commend-line X-Git-Tag: REL8_3_4~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac9562eca76729310755b2a4120bfd486d1d4d5f;p=thirdparty%2Fpostgresql.git Fix 'pg_ctl reload' to properly preserve postmaster commend-line arguments on restart. Patch to releases 8.0 - 8.3.X. --- diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index fe1ed795f91..9f41a433b6b 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.551 2008/01/11 00:54:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.551.2.1 2008/06/27 01:53:31 momjian Exp $ * * NOTES * @@ -4163,7 +4163,7 @@ CreateOptsFile(int argc, char *argv[], char *fullprogname) fprintf(fp, "%s", fullprogname); for (i = 1; i < argc; i++) - fprintf(fp, " %s%s%s", SYSTEMQUOTE, argv[i], SYSTEMQUOTE); + fprintf(fp, " \"%s\"", argv[i]); fputs("\n", fp); if (fclose(fp)) diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 83fa412282a..57cb6597939 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-2008, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.92.2.3 2008/02/29 23:31:42 adunstan Exp $ + * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.92.2.4 2008/06/27 01:53:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -613,15 +613,18 @@ read_post_opts(void) { char *arg1; - arg1 = strchr(optline, *SYSTEMQUOTE); - if (arg1 == NULL || arg1 == optline) - post_opts = ""; - else + /* + * Are we at the first option, as defined by space and + * double-quote? + */ + if ((arg1 = strstr(optline, " \"")) != NULL || + /* check in case this is an older server */ + (arg1 = strstr(optline, " -")) != NULL) { - *(arg1 - 1) = '\0'; /* this should be a space */ - post_opts = arg1; + *arg1 = '\0'; /* terminate so we get only program name */ + post_opts = arg1 + 1; /* point past whitespace */ } - if (postgres_path != NULL) + if (postgres_path == NULL) postgres_path = optline; } else