summaryrefslogtreecommitdiff
path: root/ext/socket/getnameinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/getnameinfo.c')
-rw-r--r--ext/socket/getnameinfo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index a1fa5d7..a75f233 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -208,7 +208,11 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
break;
#ifdef INET6
case AF_INET6:
+#ifdef HAVE_ADDR8
pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr8[0];
+#else
+ pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[0];
+#endif
if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
flags |= NI_NUMERICHOST;
break;