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 parentbad8277 commitf2eba41Copy full SHA for f2eba41
src/interfaces/libpq/fe-connect.c
@@ -989,16 +989,18 @@ 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);
-elseif (inet_net_ntop(conn->addr_cur->ai_family,
-&conn->addr_cur->ai_addr,
1001
-conn->addr_cur->ai_family==AF_INET ?32 :128,
+elseif (inet_net_ntop(host_addr_struct->sin_family,
1002
+&host_addr_struct->sin_addr.s_addr,
1003
+host_addr_struct->sin_family==AF_INET ?32 :128,
1004
host_addr,sizeof(host_addr))==NULL)
1005
strcpy(host_addr,"???");
1006