Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dbb397f

Browse files
committed
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.
1 parent 1e758d5 commit dbb397f

File tree

1 file changed

+10
-1
lines changed
  • src/backend/libpq

1 file changed

+10
-1
lines changed

src/backend/libpq/ip.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.36 2006/06/20 19:56:52 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.37 2006/10/19 17:26:32 tgl Exp $
1212
*
1313
* This file and the IPV6 implementation were initially provided by
1414
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@@ -72,6 +72,15 @@ pg_getaddrinfo_all(const char *hostname, const char *servname,
7272
return getaddrinfo_unix(servname, hintp, result);
7373
#endif
7474

75+
#ifdef _AIX
76+
/*
77+
* It seems AIX's getaddrinfo doesn't reliably zero sin_port when servname
78+
* is NULL, so force the issue.
79+
*/
80+
if (servname == NULL)
81+
servname = "0";
82+
#endif
83+
7584
/* NULL has special meaning to getaddrinfo(). */
7685
return getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname,
7786
servname, hintp, result);

0 commit comments

Comments
 (0)