mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Remove our inadequate kluge that tried to get AIX's various broken versions
of getaddrinfo() to work. Instead, recommend updating the OS to get a working version of getaddrinfo. Per recent discussions.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.46 2009/06/11 14:48:58 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.47 2009/06/11 19:00:15 tgl Exp $
|
||||
*
|
||||
* This file and the IPV6 implementation were initially provided by
|
||||
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
|
||||
@ -74,45 +74,9 @@ pg_getaddrinfo_all(const char *hostname, const char *servname,
|
||||
return getaddrinfo_unix(servname, hintp, result);
|
||||
#endif
|
||||
|
||||
#ifndef _AIX
|
||||
/* NULL has special meaning to getaddrinfo(). */
|
||||
rc = getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname,
|
||||
servname, hintp, result);
|
||||
#else /* _AIX */
|
||||
|
||||
/*
|
||||
* Various versions of AIX have various bugs in getaddrinfo()'s handling
|
||||
* of the servname parameter, including failing entirely if it's not NULL
|
||||
* and failing to zero sin_port when it is NULL :-(. Avoid these by
|
||||
* always passing NULL and handling the port number for ourselves.
|
||||
*/
|
||||
rc = getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname,
|
||||
NULL, hintp, result);
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
struct addrinfo *addr;
|
||||
unsigned short port = 0;
|
||||
|
||||
if (servname && *servname)
|
||||
port = atoi(servname);
|
||||
|
||||
for (addr = *result; addr; addr = addr->ai_next)
|
||||
{
|
||||
switch (addr->ai_family)
|
||||
{
|
||||
case AF_INET:
|
||||
((struct sockaddr_in *) addr->ai_addr)->sin_port = htons(port);
|
||||
break;
|
||||
#ifdef HAVE_IPV6
|
||||
case AF_INET6:
|
||||
((struct sockaddr_in6 *) addr->ai_addr)->sin6_port = htons(port);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* _AIX */
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user