Make listen_addresses be a comma-separated list instead of a space-separated

list.  More consistent with our other list-containing GUC variables.
This commit is contained in:
Tom Lane 2004-08-08 20:17:36 +00:00
parent dc199eafa7
commit 33bf242a8a
3 changed files with 29 additions and 26 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.274 2004/08/08 19:42:56 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.275 2004/08/08 20:17:33 tgl Exp $
-->
<Chapter Id="runtime">
@ -626,7 +626,7 @@ SET ENABLE_SEQSCAN TO OFF;
<para>
Specifies the TCP/IP address(es) on which the server is
to listen for connections from client applications.
The value takes the form of a space-separated list of host names
The value takes the form of a comma-separated list of host names
and/or numeric IP addresses. The special entry <literal>*</>
corresponds to all available IP interfaces.
If the list is empty, the server does not listen on any IP interface

View File

@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.420 2004/08/05 23:32:10 tgl Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.421 2004/08/08 20:17:34 tgl Exp $
*
* NOTES
*
@ -113,6 +113,7 @@
#include "storage/bufmgr.h"
#include "access/xlog.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
@ -698,23 +699,26 @@ PostmasterMain(int argc, char *argv[])
if (ListenAddresses)
{
char *curhost,
*endptr;
char c;
char *rawstring;
List *elemlist;
ListCell *l;
curhost = ListenAddresses;
for (;;)
/* Need a modifiable copy of ListenAddresses */
rawstring = pstrdup(ListenAddresses);
/* Parse string into list of identifiers */
if (!SplitIdentifierString(rawstring, ',', &elemlist))
{
/* ignore whitespace */
while (isspace((unsigned char) *curhost))
curhost++;
if (*curhost == '\0')
break;
endptr = curhost;
while (*endptr != '\0' && !isspace((unsigned char) *endptr))
endptr++;
c = *endptr;
*endptr = '\0';
/* syntax error in list */
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid list syntax for \"listen_addresses\"")));
}
foreach(l, elemlist)
{
char *curhost = (char *) lfirst(l);
if (strcmp(curhost, "*") == 0)
status = StreamServerPort(AF_UNSPEC, NULL,
(unsigned short) PostPortNumber,
@ -729,12 +733,10 @@ PostmasterMain(int argc, char *argv[])
ereport(WARNING,
(errmsg("could not create listen socket for \"%s\"",
curhost)));
*endptr = c;
if (c != '\0')
curhost = endptr + 1;
else
break;
}
list_free(elemlist);
pfree(rawstring);
}
#ifdef USE_RENDEZVOUS

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.229 2004/08/08 15:37:06 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.230 2004/08/08 20:17:36 tgl Exp $
*
*--------------------------------------------------------------------
*/
@ -1740,8 +1740,9 @@ static struct config_string ConfigureNamesString[] =
{
{"listen_addresses", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
gettext_noop("Sets the host name or IP addresses to listen to."),
NULL
gettext_noop("Sets the host name or IP address(es) to listen to."),
NULL,
GUC_LIST_INPUT
},
&ListenAddresses,
"localhost", NULL, NULL