]> git.pld-linux.org Git - packages/postgresql.git/blob - postgresql-pg_ctl-fix.patch
1c8e6bae89ab3589db0f0eb2103044ea629eaac9
[packages/postgresql.git] / postgresql-pg_ctl-fix.patch
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
3 @@ -373,9 +373,11 @@
4         int                     i;
5         char            portstr[32];
6 +       char            sockstr[256];
7         char       *p;
8         char       *q;
9  
10         *portstr = '\0';
11 +       *sockstr = '\0';
12  
13         /* post_opts */
14         for (p = post_opts; *p;)
15 @@ -400,7 +402,7 @@
16          * This parsing code isn't amazingly bright either, but it should be
17          * okay for valid port settings.
18          */
19 -       if (!*portstr)
20 +       if (!*portstr || !*sockstr)
21         {
22                 char      **optlines;
23  
24 @@ -413,18 +415,32 @@
25  
26                                 while (isspace((unsigned char) *p))
27                                         p++;
28 -                               if (strncmp(p, "port", 4) != 0)
29 -                                       continue;
30 -                               p += 4;
31 -                               while (isspace((unsigned char) *p))
32 -                                       p++;
33 -                               if (*p != '=')
34 -                                       continue;
35 -                               p++;
36 -                               while (isspace((unsigned char) *p))
37 +                               if (strncmp(p, "port", strlen("port")) == 0)
38 +                               {
39 +                                       p += strlen("port");
40 +                                       while (isspace((unsigned char) *p))
41 +                                               p++;
42 +                                       if (*p != '=')
43 +                                               continue;
44                                         p++;
45 -                               StrNCpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
46 +                                       while (isspace((unsigned char) *p))
47 +                                               p++;
48 +                                       StrNCpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
49                                                                                 sizeof(portstr)));
50 +                               }
51 +                               if (strncmp(p, "unix_socket_directory", strlen("unix_socket_directory")) == 0)
52 +                               {
53 +                                       p += strlen("unix_socket_directory");
54 +                                       while (isspace((unsigned char) *p))
55 +                                               p++;
56 +                                       if (*p != '=')
57 +                                               continue;
58 +                                       p++;
59 +                                       while (isspace((unsigned char) *p) || *p == '\'' || *p == '"')
60 +                                               p++;
61 +                                       StrNCpy(sockstr, p, Min(strcspn(p, "#\"'" WHITESPACE) + 1,
62 +                                                                               sizeof(sockstr)));
63 +                               }
64                                 /* keep looking, maybe there is another */
65                         }
66                 }
67 @@ -440,7 +456,7 @@
68  
69         for (i = 0; i < wait_seconds; i++)
70         {
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),
This page took 0.051315 seconds and 2 git commands to generate.