Skip to content

Commit 7cc1fb4

Browse files
committed
Simplify 'pg_ctl restart' detection of first argument in
postmaster.opts.
1 parent 54b9a96 commit 7cc1fb4

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/bin/pg_ctl/pg_ctl.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.101 2008/06/26 02:47:19 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.102 2008/06/26 03:51:56 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -601,18 +601,14 @@ read_post_opts(void)
601601
len = strcspn(optline, "\r\n");
602602
optline[len] = '\0';
603603

604-
for (arg1 = optline; *arg1; arg1++)
604+
/*
605+
* Are we at the first option, as defined by space and
606+
* double-quote?
607+
*/
608+
if ((arg1 = strstr(optline, " \"")) != NULL)
605609
{
606-
/*
607-
* Are we at the first option, as defined by space,
608-
* double-quote, and a dash?
609-
*/
610-
if (*arg1 == ' ' && *(arg1+1) == '"' && *(arg1+2) == '-')
611-
{
612-
*arg1 = '\0'; /* terminate so we get only program name */
613-
post_opts = arg1 + 1; /* point past whitespace */
614-
break;
615-
}
610+
*arg1 = '\0'; /* terminate so we get only program name */
611+
post_opts = arg1 + 1; /* point past whitespace */
616612
}
617613
if (postgres_path != NULL)
618614
postgres_path = optline;

0 commit comments

Comments
 (0)