Commit f2eba413 authored by Bruce Momjian's avatar Bruce Momjian

Use conn->raddr consistently for non-connect libpq error reporting.

parent bad8277f
...@@ -989,6 +989,8 @@ connectFailureMessage(PGconn *conn, int errorno) ...@@ -989,6 +989,8 @@ 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.
...@@ -996,9 +998,9 @@ connectFailureMessage(PGconn *conn, int errorno) ...@@ -996,9 +998,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, else if (inet_net_ntop(host_addr_struct->sin_family,
&conn->addr_cur->ai_addr, &host_addr_struct->sin_addr.s_addr,
conn->addr_cur->ai_family == AF_INET ? 32 : 128, host_addr_struct->sin_family == AF_INET ? 32 : 128,
host_addr, sizeof(host_addr)) == NULL) host_addr, sizeof(host_addr)) == NULL)
strcpy(host_addr, "???"); strcpy(host_addr, "???");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment