1 --- src/bin/pg_ctl/pg_ctl.c.orig 2006-04-04 15:52:48.000000000 +0000
2 +++ src/bin/pg_ctl/pg_ctl.c 2006-04-04 16:43:27.000000000 +0000
14 for (p = post_opts; *p;)
16 * This parsing code isn't amazingly bright either, but it should be
17 * okay for valid port settings.
20 + if (!*portstr || !*sockstr)
26 while (isspace((unsigned char) *p))
28 - if (strncmp(p, "port", 4) != 0)
31 - while (isspace((unsigned char) *p))
36 - while (isspace((unsigned char) *p))
37 + if (strncmp(p, "port", strlen("port")) == 0)
39 + p += strlen("port");
40 + while (isspace((unsigned char) *p))
45 - StrNCpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
46 + while (isspace((unsigned char) *p))
48 + StrNCpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
51 + if (strncmp(p, "unix_socket_directory", strlen("unix_socket_directory")) == 0)
53 + p += strlen("unix_socket_directory");
54 + while (isspace((unsigned char) *p))
59 + while (isspace((unsigned char) *p) || *p == '\'' || *p == '"')
61 + StrNCpy(sockstr, p, Min(strcspn(p, "#\"'" WHITESPACE) + 1,
64 /* keep looking, maybe there is another */
69 for (i = 0; i < wait_seconds; i++)
71 - if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL,
72 + if ((conn = PQsetdbLogin((!*sockstr ? NULL : sockstr), portstr, NULL, NULL,
73 "postgres", NULL, NULL)) != NULL &&
74 (PQstatus(conn) == CONNECTION_OK ||
75 (strcmp(PQerrorMessage(conn),