]> git.pld-linux.org Git - packages/postgresql.git/blob - postgresql-pg_ctl-fix.patch
- do PG_VERSION comparision in %pretrans
[packages/postgresql.git] / postgresql-pg_ctl-fix.patch
1 --- postgresql-8.3.0/src/bin/pg_ctl/pg_ctl.c.orig       2008-01-01 20:45:55.000000000 +0100
2 +++ postgresql-8.3.0/src/bin/pg_ctl/pg_ctl.c    2008-02-19 21:30:21.369174813 +0100
3 @@ -414,11 +414,11 @@
4         PGconn     *conn;
5         bool            success = false;
6         int                     i;
7 -       char            portstr[32];
8 +       char            portstr[32], sockstr[MAXPGPATH];
9         char       *p;
10 -       char            connstr[128];   /* Should be way more than enough! */
11 +       char            connstr[128+MAXPGPATH]; /* Should be way more than enough! */
12  
13 -       *portstr = '\0';
14 +       *portstr = *sockstr = '\0';
15  
16         /* post_opts */
17         for (p = post_opts; *p;)
18 @@ -436,6 +436,15 @@
19                         strlcpy(portstr, p, Min(strcspn(p, "\"'" WHITESPACE) + 1,
20                                                                         sizeof(portstr)));
21                         /* keep looking, maybe there is another -p */
22 +               } else if (strncmp(p, "-k", strlen("-k")) == 0)
23 +               {
24 +                       p += strlen("-k");
25 +                       /* advance past whitespace/quoting */
26 +                       while (isspace((unsigned char) *p) || *p == '\'' || *p == '"')
27 +                               p++;
28 +                       strlcpy(sockstr, p, Min(strcspn(p, "\"'" WHITESPACE) + 1,
29 +                                                                       sizeof(sockstr)));
30 +                       /* keep looking, maybe there is another -k */
31                 }
32                 /* Advance to next whitespace */
33                 while (*p && !isspace((unsigned char) *p))
34 @@ -443,7 +452,7 @@
35         }
36  
37         /* config file */
38 -       if (!*portstr)
39 +       if (!*portstr || !*sockstr)
40         {
41                 char      **optlines;
42  
43 @@ -456,19 +465,30 @@
44  
45                                 while (isspace((unsigned char) *p))
46                                         p++;
47 -                               if (strncmp(p, "port", strlen("port")) != 0)
48 -                                       continue;
49 -                               p += strlen("port");
50 -                               while (isspace((unsigned char) *p))
51 +                               if (!strncmp(p, "port", strlen("port"))) {
52 +                                       p += strlen("port");
53 +                                       while (isspace((unsigned char) *p))
54 +                                               p++;
55 +                                       if (*p != '=')
56 +                                               continue;
57                                         p++;
58 -                               if (*p != '=')
59 -                                       continue;
60 -                               p++;
61 -                               while (isspace((unsigned char) *p))
62 +                                       while (isspace((unsigned char) *p))
63 +                                               p++;
64 +                                       strlcpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
65 +                                                                                       sizeof(portstr)));
66 +                                       /* keep looking, maybe there is another */
67 +                               } else if(!strncmp(p, "unix_socket_directory", strlen("unix_socket_directory"))) {
68 +                                       p += strlen("unix_socket_directory");
69 +                                       while (isspace((unsigned char) *p))
70 +                                               p++;
71 +                                       if (*p != '=')
72 +                                               continue;
73                                         p++;
74 -                               strlcpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
75 -                                                                               sizeof(portstr)));
76 -                               /* keep looking, maybe there is another */
77 +                                       while (isspace((unsigned char) *p) || *p == '\'' || *p == '"')
78 +                                               p++;
79 +                                       strlcpy(sockstr, p, Min(strcspn(p, "\"'#" WHITESPACE) + 1,
80 +                                                                                       sizeof(sockstr)));
81 +                               }
82                         }
83                 }
84         }
85 @@ -486,7 +506,8 @@
86          * probably timeout first
87          */
88         snprintf(connstr, sizeof(connstr),
89 -                        "dbname=postgres port=%s connect_timeout=5", portstr);
90 +                        "dbname=postgres port=%s connect_timeout=5%s%s", portstr,
91 +                        (*sockstr ? " host=" : ""), sockstr);
92  
93         for (i = 0; i < wait_seconds; i++)
94         {
This page took 0.080743 seconds and 3 git commands to generate.