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

Commit9484982

Browse files
author
Michael Meskes
committed
Do not use an empty hostname.
When trying to connect to a given database libecpg should not try using anempty hostname if no hostname was given.
1 parentc41f036 commit9484982

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
324324

325325
if (dbname!=NULL)
326326
{
327-
/* get the detail informationout of dbname */
327+
/* get the detail informationfrom dbname */
328328
if (strncmp(dbname,"tcp:",4)==0||strncmp(dbname,"unix:",5)==0)
329329
{
330330
intoffset=0;
@@ -343,7 +343,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
343343
/*------
344344
* new style:
345345
*<tcp|unix>:postgresql://server[:port|:/unixsocket/path:]
346-
*[/dbname][?options]
346+
*[/db-name][?options]
347347
*------
348348
*/
349349
offset+=strlen("postgresql://");
@@ -418,8 +418,10 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
418418
}
419419
}
420420
else
421-
host=ecpg_strdup(dbname+offset,lineno);
422-
421+
{
422+
if (*(dbname+offset)!='\0')
423+
host=ecpg_strdup(dbname+offset,lineno);
424+
}
423425
}
424426
}
425427
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp