diff options
author | Bruce Momjian <bruce@momjian.us> | 2003-12-19 23:32:36 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2003-12-19 23:32:36 +0000 |
commit | 41f60b20fd8e4c13cb7d9c407c82d4617cfef670 (patch) | |
tree | 663047b9342373fcf730159e97219d5d7e5d9f2b /src | |
parent | cdbfbcf9870da573a5f6ff450a857349b4580e8a (diff) | |
download | postgresql-41f60b20fd8e4c13cb7d9c407c82d4617cfef670.tar.gz postgresql-41f60b20fd8e4c13cb7d9c407c82d4617cfef670.zip |
Backpatch pg_service.conf file change to not default dbname to match
service name.
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 28 | ||||
-rw-r--r-- | src/interfaces/libpq/pg_service.conf.sample | 4 |
2 files changed, 9 insertions, 23 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 9dde3043c70..4e5eb289b8b 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.263 2003/10/18 05:02:06 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.263.2.1 2003/12/19 23:32:36 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -2367,7 +2367,7 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) { char *service = conninfo_getval(options, "service"); char *serviceFile = SYSCONFDIR "/pg_service.conf"; - int group_found = 0; + bool group_found = false; int linenr = 0, i; @@ -2431,9 +2431,9 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) if (strncmp(line + 1, service, strlen(service)) == 0 && line[strlen(service) + 1] == ']') - group_found = 1; + group_found = true; else - group_found = 0; + group_found = false; } else { @@ -2445,7 +2445,7 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) */ char *key, *val; - int found_keyword; + bool found_keyword; key = line; val = strchr(line, '='); @@ -2461,31 +2461,17 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) *val++ = '\0'; /* - * If not already set, set the database name to the - * name of the service - */ - for (i = 0; options[i].keyword; i++) - { - if (strcmp(options[i].keyword, "dbname") == 0) - { - if (options[i].val == NULL) - options[i].val = strdup(service); - break; - } - } - - /* * Set the parameter --- but don't override any * previous explicit setting. */ - found_keyword = 0; + found_keyword = false; for (i = 0; options[i].keyword; i++) { if (strcmp(options[i].keyword, key) == 0) { if (options[i].val == NULL) options[i].val = strdup(val); - found_keyword = 1; + found_keyword = true; break; } } diff --git a/src/interfaces/libpq/pg_service.conf.sample b/src/interfaces/libpq/pg_service.conf.sample index d5d486f904a..e15d79b91ea 100644 --- a/src/interfaces/libpq/pg_service.conf.sample +++ b/src/interfaces/libpq/pg_service.conf.sample @@ -5,12 +5,12 @@ # multiple services in this file. Each starts with a service name in # brackets. Subsequent lines have connection configuration parameters of # the pattern "param=value". A sample configuration for template1 is -# included in this file. If no database name is specified, it is assumed -# to match the service name. Lines beginning with '#' are comments. +# included in this file. Lines beginning with '#' are comments. # # Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and # rename it pg_service.conf. # # #[template1] +#dbname=template1 #user=postgres |