From 62118e0fdbbbd26675432303619ce462f5fff423 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Wed, 8 Aug 2012 11:02:27 +0200 Subject: [PATCH] - fix build --- postgresql-pg_ctl-fix.patch | 48 ++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/postgresql-pg_ctl-fix.patch b/postgresql-pg_ctl-fix.patch index 1c8e6ba..d8efe1a 100644 --- a/postgresql-pg_ctl-fix.patch +++ b/postgresql-pg_ctl-fix.patch @@ -21,49 +21,43 @@ { char **optlines; -@@ -413,18 +415,32 @@ +@@ -432,8 +432,7 @@ while (isspace((unsigned char) *p)) p++; - if (strncmp(p, "port", 4) != 0) - continue; -- p += 4; -- while (isspace((unsigned char) *p)) -- p++; -- if (*p != '=') -- continue; -- p++; -- while (isspace((unsigned char) *p)) -+ if (strncmp(p, "port", strlen("port")) == 0) -+ { -+ p += strlen("port"); -+ while (isspace((unsigned char) *p)) -+ p++; -+ if (*p != '=') -+ continue; ++ if (!strncmp(p, "port", 4) != 0) { + p += 4; + while (isspace((unsigned char) *p)) p++; -- StrNCpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1, -+ while (isspace((unsigned char) *p)) -+ p++; -+ StrNCpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1, - sizeof(portstr))); -+ } -+ if (strncmp(p, "unix_socket_directory", strlen("unix_socket_directory")) == 0) -+ { -+ p += strlen("unix_socket_directory"); +@@ -452,6 +451,26 @@ + /* and save the argument value */ + StrNCpy(portstr, p, Min((q - p) + 1, sizeof(portstr))); + /* keep looking, maybe there is another */ ++ } else if(!strncmp(p, "unix_socket_directory", 21)) { ++ p += 21; + while (isspace((unsigned char) *p)) + p++; + if (*p != '=') + continue; + p++; ++ /* advance past any whitespace/quoting */ + while (isspace((unsigned char) *p) || *p == '\'' || *p == '"') + p++; -+ StrNCpy(sockstr, p, Min(strcspn(p, "#\"'" WHITESPACE) + 1, -+ sizeof(sockstr))); ++ /* find end of value (not including any ending quote/comment!) */ ++ q = p; ++ while (*q && ++ !(isspace((unsigned char) *q) || ++ *q == '\'' || *q == '"' || *q == '#')) ++ q++; ++ /* and save the argument value */ ++ StrNCpy(sockstr, p, Min((q - p) + 1, sizeof(portstr))); ++ /* keep looking, maybe there is another */ + } - /* keep looking, maybe there is another */ } } + } @@ -440,7 +456,7 @@ for (i = 0; i < wait_seconds; i++) -- 2.44.0