]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix 'pg_ctl reload' to properly preserve postmaster commend-line
authorBruce Momjian <bruce@momjian.us>
Fri, 27 Jun 2008 01:52:58 +0000 (01:52 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 27 Jun 2008 01:52:58 +0000 (01:52 +0000)
arguments on restart.  Patch to releases 8.0 - 8.3.X.

src/backend/postmaster/postmaster.c
src/bin/pg_ctl/pg_ctl.c

index 4a56f4ecf3bfb91859ba5cdacfdb151ad97717d6..1d491b8b31716e79f15f325ee36cadae64388f14 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.443.4.10 2007/08/02 23:20:22 adunstan Exp $
+ *       $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.443.4.11 2008/06/27 01:52:58 momjian Exp $
  *
  * NOTES
  *
@@ -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))
index 6ad31f099f98a976a9585310e3909fc901699461..12c230e3837b27c7d168f845bd1698b8224f4a5e 100644 (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.5 2008/02/20 22:18:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.53.4.6 2008/06/27 01:52:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -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