summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index ae02129..d4edfd5 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -173,6 +173,30 @@ ruby_getaddrinfo(nodename, servname, hints, res)
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res))
#endif
+#if defined(_AIX)
+static int
+ruby_getaddrinfo__aix(nodename, servname, hints, res)
+ char *nodename;
+ char *servname;
+ struct addrinfo *hints;
+ struct addrinfo **res;
+{
+ int error = getaddrinfo(nodename, servname, hints, res);
+ struct addrinfo *r;
+ if (error)
+ return error;
+ for (r = *res; r != NULL; r = r->ai_next) {
+ if (r->ai_addr->sa_family == 0)
+ r->ai_addr->sa_family = r->ai_family;
+ if (r->ai_addr->sa_len == 0)
+ r->ai_addr->sa_len = r->ai_addrlen;
+ }
+ return 0;
+}
+#undef getaddrinfo
+#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
+#endif
+
#ifdef HAVE_CLOSESOCKET
#undef close
#define close closesocket
@@ -2413,7 +2437,9 @@ sock_s_getnameinfo(argc, argv)
* 4th element holds numeric form, don't resolve.
* see ipaddr().
*/
+#ifdef AI_NUMERICHOST /* AIX 4.3.3 doesn't have AI_NUMERICHOST. */
hints.ai_flags |= AI_NUMERICHOST;
+#endif
}
}
else {