aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 14123c2fe03..eca35e3ea38 100644
--- a/src/backend/libpq/ip.c
+++ b/src/backend/libpq/ip.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.31 2004/12/31 21:59:50 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.31.4.1 2006/10/19 17:26:43 tgl Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@@ -75,6 +75,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);