Bring back strdup on optline in pg_ctl read_post_opts
The strdups were removed in a recent 8.4 postgres merge commit
Without them, pg_ctl restart will usually fail as the memory
is freed for optline. Bring them back similar to how it was fixed in
an earlier commit.
Reference commit by Daniel Gustafsson:
@@ -697,10 +697,10 @@ read_post_opts(void)
if ((arg1 = strstr(optline, " \"")) != NULL)
{
*arg1 = '\0'; /* terminate so we get only program name */
- post_opts = arg1 + 1; /* point past whitespace */
+ post_opts = strdup(arg1 + 1); /* point past whitespace */
}
if (postgres_path == NULL)
- postgres_path = optline;
+ postgres_path = strdup(optline);
}
/* Free the results of readfile. */
