summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-10-19 17:26:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-10-19 17:26:51 +0000
commit8df0bcc69652974def6b12848a4639c7f0a81526 (patch)
tree846d9fe3effe12e3e322a8f0c31e669e95f7b4f8
parent62f9cbf4241732c36e75372932ddcbd8eb01e726 (diff)
Work around reported problem that AIX's getaddrinfo() doesn't seem to zero
sin_port in the returned IP address struct when servname is NULL. This has been observed to cause failure to bind the stats collection socket, and could perhaps cause other issues too. Per reports from Brad Nicholson and Chris Browne.
-rw-r--r--src/backend/libpq/ip.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/libpq/ip.c b/src/backend/libpq/ip.c
index 33f0832b930..ee3605db599 100644
--- a/src/backend/libpq/ip.c
+++ b/src/backend/libpq/ip.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/ip.c,v 1.23.2.2 2004/11/08 01:54:58 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/ip.c,v 1.23.2.3 2006/10/19 17:26:51 tgl Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@@ -77,6 +77,15 @@ getaddrinfo_all(const char *hostname, const char *servname,
return getaddrinfo_unix(servname, hintp, result);
#endif
+#ifdef _AIX
+ /*
+ * It seems AIX's getaddrinfo doesn't reliably zero sin_port when servname
+ * is NULL, so force the issue.
+ */
+ if (servname == NULL)
+ servname = "0";
+#endif
+
/* NULL has special meaning to getaddrinfo */
return getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname,
servname, hintp, result);