summaryrefslogtreecommitdiff
path: root/ext/socket/basicsocket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-09 10:59:55 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-09 10:59:55 +0000
commit7d63280c17acff8093b9e909349eafbbab19f8fe (patch)
treeacb55b096bda624234e0ef11ac0f6e3ed043a1a2 /ext/socket/basicsocket.c
parent48de4753d1b376953676463ceddf75c303acdd94 (diff)
* ext/socket/basicsocket.c (bsock_getsockopt): refine address family
examination. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/basicsocket.c')
-rw-r--r--ext/socket/basicsocket.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c
index 65c19d0..fdd2ce7 100644
--- a/ext/socket/basicsocket.c
+++ b/ext/socket/basicsocket.c
@@ -300,14 +300,13 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
GetOpenFile(sock, fptr);
+ ss.ss_family = AF_UNSPEC;
if (getsockname(fptr->fd, (struct sockaddr*)&ss, &sslen) < 0)
rb_sys_fail("getsockname(2)");
if (getsockopt(fptr->fd, level, option, buf, &len) < 0)
rb_sys_fail_path(fptr->pathv);
- if (sslen < (char*)&ss.ss_family + sizeof(ss.ss_family) - (char*)&ss)
- ss.ss_family = AF_UNSPEC;
return sockopt_new(ss.ss_family, level, option, rb_str_new(buf, len));
#else
rb_notimplement();