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

Commitbe5d499

Browse files
committed
Fix bugs in PQhost().
In the platform that doesn't support Unix-domain socket, whenneither host nor hostaddr are specified, the default host'localhost' is used to connect to the server and PQhost() mustreturn that, but it didn't. This patch fixes PQhost() so thatit returns the default host in that case.Also this patch fixes PQhost() so that it doesn't returnUnix-domain socket directory path in the platform that doesn'tsupport Unix-domain socket.Back-patch to all supported versions.
1 parentd1e3070 commitbe5d499

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5183,7 +5183,16 @@ PQhost(const PGconn *conn)
51835183
{
51845184
if (!conn)
51855185
returnNULL;
5186-
returnconn->pghost ?conn->pghost :conn->pgunixsocket;
5186+
if (conn->pghost!=NULL&&conn->pghost[0]!='\0')
5187+
returnconn->pghost;
5188+
else
5189+
{
5190+
#ifdefHAVE_UNIX_SOCKETS
5191+
returnconn->pgunixsocket;
5192+
#else
5193+
returnDefaultHost;
5194+
#endif
5195+
}
51875196
}
51885197

51895198
char*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp