From: Bruce Momjian Date: Fri, 27 Jun 2008 01:52:58 +0000 (+0000) Subject: Fix 'pg_ctl reload' to properly preserve postmaster commend-line X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=3570225bdcaaa69da22d889aca947a7b49fa519a;p=users%2Fbernd%2Fpostgres.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 ee56f39596..5cdc6ace38 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -3655,7 +3655,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 eb5c11142b..34ae0f0642 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -535,15 +535,18 @@ do_start(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