We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent4f6deef commited51bd4Copy full SHA for ed51bd4
src/interfaces/libpq/fe-connect.c
@@ -989,17 +989,16 @@ connectFailureMessage(PGconn *conn, int errorno)
989
{
990
charhost_addr[NI_MAXHOST];
991
booldisplay_host_addr;
992
-structsockaddr_in*host_addr_struct= (structsockaddr_in*)
993
-&conn->raddr.addr;
994
995
/*
996
*Optionally display the network address with the hostname.
997
*This is useful to distinguish between IPv4 and IPv6 connections.
998
*/
999
if (conn->pghostaddr!=NULL)
1000
strlcpy(host_addr,conn->pghostaddr,NI_MAXHOST);
1001
-elseif (inet_net_ntop(conn->addr_cur->ai_family,&host_addr_struct->sin_addr,
1002
-host_addr_struct->sin_family==AF_INET ?32 :128,
+elseif (inet_net_ntop(conn->addr_cur->ai_family,
+&conn->addr_cur->ai_addr,
+conn->addr_cur->ai_family==AF_INET ?32 :128,
1003
host_addr,sizeof(host_addr))==NULL)
1004
strcpy(host_addr,"???");
1005