mirror of
https://github.com/postgres/postgres.git
synced 2025-05-09 18:21:05 +03:00
Make sure --with-pgport option propagates into postgresql.conf.
Per gripe from Josh Berkus.
This commit is contained in:
parent
39475990e0
commit
361f354109
@ -39,7 +39,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
* Portions taken from FreeBSD.
|
* Portions taken from FreeBSD.
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.70 2004/11/29 03:05:03 tgl Exp $
|
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.71 2004/12/27 20:39:21 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -147,9 +147,10 @@ char backend_exec[MAXPGPATH];
|
|||||||
|
|
||||||
static void *xmalloc(size_t size);
|
static void *xmalloc(size_t size);
|
||||||
static char *xstrdup(const char *s);
|
static char *xstrdup(const char *s);
|
||||||
static char **replace_token(char **lines, char *token, char *replacement);
|
static char **replace_token(char **lines,
|
||||||
|
const char *token, const char *replacement);
|
||||||
#ifndef HAVE_UNIX_SOCKETS
|
#ifndef HAVE_UNIX_SOCKETS
|
||||||
static char **filter_lines_with_token(char **lines, char *token);
|
static char **filter_lines_with_token(char **lines, const char *token);
|
||||||
#endif
|
#endif
|
||||||
static char **readfile(char *path);
|
static char **readfile(char *path);
|
||||||
static void writefile(char *path, char **lines);
|
static void writefile(char *path, char **lines);
|
||||||
@ -275,7 +276,7 @@ xstrdup(const char *s)
|
|||||||
* doesn't need any regexp stuff.
|
* doesn't need any regexp stuff.
|
||||||
*/
|
*/
|
||||||
static char **
|
static char **
|
||||||
replace_token(char **lines, char *token, char *replacement)
|
replace_token(char **lines, const char *token, const char *replacement)
|
||||||
{
|
{
|
||||||
int numlines = 1;
|
int numlines = 1;
|
||||||
int i;
|
int i;
|
||||||
@ -300,7 +301,6 @@ replace_token(char **lines, char *token, char *replacement)
|
|||||||
int pre;
|
int pre;
|
||||||
|
|
||||||
/* just copy pointer if NULL or no change needed */
|
/* just copy pointer if NULL or no change needed */
|
||||||
|
|
||||||
if (lines[i] == NULL || (where = strstr(lines[i], token)) == NULL)
|
if (lines[i] == NULL || (where = strstr(lines[i], token)) == NULL)
|
||||||
{
|
{
|
||||||
result[i] = lines[i];
|
result[i] = lines[i];
|
||||||
@ -320,21 +320,19 @@ replace_token(char **lines, char *token, char *replacement)
|
|||||||
strcpy(newline + pre + replen, lines[i] + pre + toklen);
|
strcpy(newline + pre + replen, lines[i] + pre + toklen);
|
||||||
|
|
||||||
result[i] = newline;
|
result[i] = newline;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make a copy of lines without any that contain the token
|
* make a copy of lines without any that contain the token
|
||||||
* a sort of poor man's grep -v
|
|
||||||
*
|
*
|
||||||
|
* a sort of poor man's grep -v
|
||||||
*/
|
*/
|
||||||
#ifndef HAVE_UNIX_SOCKETS
|
#ifndef HAVE_UNIX_SOCKETS
|
||||||
static char **
|
static char **
|
||||||
filter_lines_with_token(char **lines, char *token)
|
filter_lines_with_token(char **lines, const char *token)
|
||||||
{
|
{
|
||||||
int numlines = 1;
|
int numlines = 1;
|
||||||
int i, src, dst;
|
int i, src, dst;
|
||||||
@ -1165,6 +1163,11 @@ setup_config(void)
|
|||||||
snprintf(repltok, sizeof(repltok), "shared_buffers = %d", n_buffers);
|
snprintf(repltok, sizeof(repltok), "shared_buffers = %d", n_buffers);
|
||||||
conflines = replace_token(conflines, "#shared_buffers = 1000", repltok);
|
conflines = replace_token(conflines, "#shared_buffers = 1000", repltok);
|
||||||
|
|
||||||
|
#if DEF_PGPORT != 5432
|
||||||
|
snprintf(repltok, sizeof(repltok), "#port = %d", DEF_PGPORT);
|
||||||
|
conflines = replace_token(conflines, "#port = 5432", repltok);
|
||||||
|
#endif
|
||||||
|
|
||||||
lc_messages = escape_quotes(lc_messages);
|
lc_messages = escape_quotes(lc_messages);
|
||||||
snprintf(repltok, sizeof(repltok), "lc_messages = '%s'", lc_messages);
|
snprintf(repltok, sizeof(repltok), "lc_messages = '%s'", lc_messages);
|
||||||
conflines = replace_token(conflines, "#lc_messages = 'C'", repltok);
|
conflines = replace_token(conflines, "#lc_messages = 'C'", repltok);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user