зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
48de4753d1
Коммит
7d63280c17
|
@ -1,3 +1,8 @@
|
|||
Mon Feb 9 19:59:18 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/basicsocket.c (bsock_getsockopt): refine address family
|
||||
examination.
|
||||
|
||||
Mon Feb 9 19:52:32 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/option.c (sockopt_initialize): argument conversion
|
||||
|
|
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче