aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2010-11-26 13:26:13 -0500
committerBruce Momjian <bruce@momjian.us>2010-11-26 13:26:13 -0500
commitf2eba413db99fcde9a4d3a9f52578dc4e7f5d5ec (patch)
treebf8e8cfe648e0c0ee4231e0663089a2f657f6a1c /src/interfaces/libpq/fe-connect.c
parentbad8277f13c31350abd7571af51d272bd1401f3c (diff)
downloadpostgresql-f2eba413db99fcde9a4d3a9f52578dc4e7f5d5ec.tar.gz
postgresql-f2eba413db99fcde9a4d3a9f52578dc4e7f5d5ec.zip
Use conn->raddr consistently for non-connect libpq error reporting.
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 44a3c715307..cdf8ee4929d 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -989,6 +989,8 @@ connectFailureMessage(PGconn *conn, int errorno)
{
char host_addr[NI_MAXHOST];
bool display_host_addr;
+ struct sockaddr_in *host_addr_struct = (struct sockaddr_in *)
+ &conn->raddr.addr;
/*
* Optionally display the network address with the hostname.
@@ -996,9 +998,9 @@ connectFailureMessage(PGconn *conn, int errorno)
*/
if (conn->pghostaddr != NULL)
strlcpy(host_addr, conn->pghostaddr, NI_MAXHOST);
- else if (inet_net_ntop(conn->addr_cur->ai_family,
- &conn->addr_cur->ai_addr,
- conn->addr_cur->ai_family == AF_INET ? 32 : 128,
+ else if (inet_net_ntop(host_addr_struct->sin_family,
+ &host_addr_struct->sin_addr.s_addr,
+ host_addr_struct->sin_family == AF_INET ? 32 : 128,
host_addr, sizeof(host_addr)) == NULL)
strcpy(host_addr, "???");