Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9270f1c

Browse files
committed
Only set the database name if we find a match in the services file.
1 parent6f14e27 commit9270f1c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.219 2003/01/07 04:25:29 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.220 2003/01/08 16:21:53 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -133,7 +133,7 @@ static const PQconninfoOption PQconninfoOptions[] = {
133133

134134
{"hostaddr","PGHOSTADDR",NULL,NULL,
135135
"Database-Host-IP-Address","",45},
136-
136+
137137
{"port","PGPORT",DEF_PGPORT_STR,NULL,
138138
"Database-Port","",6},
139139

@@ -2338,12 +2338,6 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
23382338
return1;
23392339
}
23402340

2341-
/* If not already set, set the database name to the name of the service */
2342-
for (i=0;options[i].keyword;i++)
2343-
if (strcmp(options[i].keyword,"dbname")==0)
2344-
if (options[i].val==NULL)
2345-
options[i].val=strdup(service);
2346-
23472341
while ((line=fgets(buf,MAXBUFSIZE-1,f))!=NULL)
23482342
{
23492343
linenr++;
@@ -2408,6 +2402,16 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
24082402
fclose(f);
24092403
return3;
24102404
}
2405+
2406+
/*
2407+
*If not already set, set the database name to the
2408+
*name of the service
2409+
*/
2410+
for (i=0;options[i].keyword;i++)
2411+
if (strcmp(options[i].keyword,"dbname")==0)
2412+
if (options[i].val==NULL)
2413+
options[i].val=strdup(service);
2414+
24112415
val=line+strlen(line)+1;
24122416

24132417
found_keyword=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp