mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
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.
This commit is contained in:
parent
10a6e431d3
commit
375cb7cfb0
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user