mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 10:41:19 +02:00
Use only addr_cur when reporting connection failures in libpq.
This commit is contained in:
parent
4f6deef2fb
commit
ed51bd4968
@ -989,8 +989,6 @@ connectFailureMessage(PGconn *conn, int errorno)
|
|||||||
{
|
{
|
||||||
char host_addr[NI_MAXHOST];
|
char host_addr[NI_MAXHOST];
|
||||||
bool display_host_addr;
|
bool display_host_addr;
|
||||||
struct sockaddr_in *host_addr_struct = (struct sockaddr_in *)
|
|
||||||
&conn->raddr.addr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Optionally display the network address with the hostname.
|
* Optionally display the network address with the hostname.
|
||||||
@ -998,8 +996,9 @@ connectFailureMessage(PGconn *conn, int errorno)
|
|||||||
*/
|
*/
|
||||||
if (conn->pghostaddr != NULL)
|
if (conn->pghostaddr != NULL)
|
||||||
strlcpy(host_addr, conn->pghostaddr, NI_MAXHOST);
|
strlcpy(host_addr, conn->pghostaddr, NI_MAXHOST);
|
||||||
else if (inet_net_ntop(conn->addr_cur->ai_family, &host_addr_struct->sin_addr,
|
else if (inet_net_ntop(conn->addr_cur->ai_family,
|
||||||
host_addr_struct->sin_family == AF_INET ? 32 : 128,
|
&conn->addr_cur->ai_addr,
|
||||||
|
conn->addr_cur->ai_family == AF_INET ? 32 : 128,
|
||||||
host_addr, sizeof(host_addr)) == NULL)
|
host_addr, sizeof(host_addr)) == NULL)
|
||||||
strcpy(host_addr, "???");
|
strcpy(host_addr, "???");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user