Skip to content
Snippets Groups Projects
Commit dbb397f3 authored by Tom Lane's avatar Tom Lane
Browse files

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.
parent 1e758d52
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.36 2006/06/20 19:56:52 tgl Exp $ * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.37 2006/10/19 17:26:32 tgl Exp $
* *
* This file and the IPV6 implementation were initially provided by * This file and the IPV6 implementation were initially provided by
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design * Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
...@@ -72,6 +72,15 @@ pg_getaddrinfo_all(const char *hostname, const char *servname, ...@@ -72,6 +72,15 @@ pg_getaddrinfo_all(const char *hostname, const char *servname,
return getaddrinfo_unix(servname, hintp, result); return getaddrinfo_unix(servname, hintp, result);
#endif #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(). */ /* NULL has special meaning to getaddrinfo(). */
return getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname, return getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname,
servname, hintp, result); servname, hintp, result);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment