summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-18 09:03:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-18 09:03:16 +0000
commit125ca1a11a53810ac311012352f5b0773fc2bbde (patch)
tree2b9ac558373e9742e475be19fed72bfb7924a0f9 /ext/socket
parent40a3f601e43a137e56b2c28454ffb6ce79d7ec7e (diff)
19991018
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/extconf.rb5
-rw-r--r--ext/socket/socket.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 47addfeff84..467c052a851 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -160,6 +160,10 @@ if try_run(<<EOF)
#include <sys/socket.h>
#include <netinet/in.h>
+#ifndef AF_LOCAL
+#define AF_LOCAL AF_UNIX
+#endif
+
main()
{
int passive, gaierr, inet4 = 0, inet6 = 0;
@@ -176,6 +180,7 @@ main()
goto bad;
}
for (ai = aitop; ai; ai = ai->ai_next) {
+ if (ai->ai_family == AF_LOCAL) continue;
if (ai->ai_addr == NULL ||
ai->ai_addrlen == 0 ||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index a1d707122ec..408257eeb63 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -890,7 +890,9 @@ tcp_s_gethostbyname(obj, host)
struct sockaddr_in6 sin6;
MEMZERO(&sin6, struct sockaddr_in6, 1);
sin6.sin6_family = AF_INET;
+#ifdef SIN6_LEN
sin6.sin6_len = sizeof(sin6);
+#endif
memcpy((char *) &sin6.sin6_addr, *pch, h->h_length);
h = gethostbyaddr((char *)&sin6.sin6_addr,
sizeof(sin6.sin6_addr),