summaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2003-01-07 04:25:29 +0000
committerBruce Momjian <bruce@momjian.us>2003-01-07 04:25:29 +0000
commitc859cda7829f69d8d5562236fc012a3ff5f65012 (patch)
treef5409447317a488eeacb358e9758d3211d32b5a1 /src/interfaces
parent973a210cce990134f63da12f8ca2d4d0718a103e (diff)
Document libpq service capability, and add sample file.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/libpq/fe-connect.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 7ff4de0debc..0e015f191fa 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.218 2003/01/06 22:48:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.219 2003/01/07 04:25:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2338,14 +2338,11 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
return 1;
}
- /* As default, set the database name to the name of the service */
+ /* 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)
- free(options[i].val);
- options[i].val = strdup(service);
- }
+ if (options[i].val == NULL)
+ options[i].val = strdup(service);
while ((line = fgets(buf, MAXBUFSIZE - 1, f)) != NULL)
{