summaryrefslogtreecommitdiff
path: root/ext/socket/ipsocket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-01 11:05:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-01 11:05:47 +0000
commitb7fd00c8fa50f592e958540b0604114a6471275f (patch)
treed71c3e2a2c3c198c88eb7eea90de8754c8634cba /ext/socket/ipsocket.c
parentf6a8c82e2d86a23ede061cb9991ba13e237afd44 (diff)
* ext/socket/ipsocket.c (init_inetsock_internal): Use an address
family for local address wihch is different to the remote address if no other choice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/ipsocket.c')
-rw-r--r--ext/socket/ipsocket.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index 01290cb..a146797 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -68,8 +68,13 @@ init_inetsock_internal(struct inetsock_arg *arg)
if (lres->ai_family == res->ai_family)
break;
}
- if (!lres)
- continue;
+ if (!lres) {
+ if (res->ai_next)
+ continue;
+ /* Use a different family local address if no choice, this
+ * will cause EAFNOSUPPORT. */
+ lres = arg->local.res;
+ }
}
status = rsock_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
syscall = "socket(2)";