Skip to content

Commit 361f354

Browse files
committed
Make sure --with-pgport option propagates into postgresql.conf.
Per gripe from Josh Berkus.
1 parent 3947599 commit 361f354

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/bin/initdb/initdb.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.70 2004/11/29 03:05:03 tgl Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.71 2004/12/27 20:39:21 tgl Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -147,9 +147,10 @@ char backend_exec[MAXPGPATH];
147147

148148
static void *xmalloc(size_t size);
149149
static char *xstrdup(const char *s);
150-
static char **replace_token(char **lines, char *token, char *replacement);
150+
static char **replace_token(char **lines,
151+
const char *token, const char *replacement);
151152
#ifndef HAVE_UNIX_SOCKETS
152-
static char **filter_lines_with_token(char **lines, char *token);
153+
static char **filter_lines_with_token(char **lines, const char *token);
153154
#endif
154155
static char **readfile(char *path);
155156
static void writefile(char *path, char **lines);
@@ -275,7 +276,7 @@ xstrdup(const char *s)
275276
* doesn't need any regexp stuff.
276277
*/
277278
static char **
278-
replace_token(char **lines, char *token, char *replacement)
279+
replace_token(char **lines, const char *token, const char *replacement)
279280
{
280281
int numlines = 1;
281282
int i;
@@ -300,7 +301,6 @@ replace_token(char **lines, char *token, char *replacement)
300301
int pre;
301302

302303
/* just copy pointer if NULL or no change needed */
303-
304304
if (lines[i] == NULL || (where = strstr(lines[i], token)) == NULL)
305305
{
306306
result[i] = lines[i];
@@ -320,21 +320,19 @@ replace_token(char **lines, char *token, char *replacement)
320320
strcpy(newline + pre + replen, lines[i] + pre + toklen);
321321

322322
result[i] = newline;
323-
324323
}
325324

326325
return result;
327-
328326
}
329327

330328
/*
331329
* make a copy of lines without any that contain the token
332-
* a sort of poor man's grep -v
333330
*
331+
* a sort of poor man's grep -v
334332
*/
335333
#ifndef HAVE_UNIX_SOCKETS
336334
static char **
337-
filter_lines_with_token(char **lines, char *token)
335+
filter_lines_with_token(char **lines, const char *token)
338336
{
339337
int numlines = 1;
340338
int i, src, dst;
@@ -1165,6 +1163,11 @@ setup_config(void)
11651163
snprintf(repltok, sizeof(repltok), "shared_buffers = %d", n_buffers);
11661164
conflines = replace_token(conflines, "#shared_buffers = 1000", repltok);
11671165

1166+
#if DEF_PGPORT != 5432
1167+
snprintf(repltok, sizeof(repltok), "#port = %d", DEF_PGPORT);
1168+
conflines = replace_token(conflines, "#port = 5432", repltok);
1169+
#endif
1170+
11681171
lc_messages = escape_quotes(lc_messages);
11691172
snprintf(repltok, sizeof(repltok), "lc_messages = '%s'", lc_messages);
11701173
conflines = replace_token(conflines, "#lc_messages = 'C'", repltok);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy