diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-03 06:50:41 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-03 06:50:41 +0000 |
commit | 1f50a1e4e7ed0c0a2eb33b8f0f21821c80a99930 (patch) | |
tree | ddf143d1605f30fa4f4c2b6550669837ab2138e4 | |
parent | 03613d9255e24a4d9343ec98f99624046f1d3cf2 (diff) | |
download | ruby-1f50a1e4e7ed0c0a2eb33b8f0f21821c80a99930.tar.gz ruby-1f50a1e4e7ed0c0a2eb33b8f0f21821c80a99930.tar.xz ruby-1f50a1e4e7ed0c0a2eb33b8f0f21821c80a99930.zip |
* ext/socket/socket.c (s_recv, s_recvfrom): some systems (such as
windows) doesn't set fromlen if the socket is connection-oriented.
reported by Bram Whillock in [ruby-core:10512] [ruby-Bugs#9061]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/socket/socket.c | 4 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Tue Apr 3 15:50:41 2007 NAKAMURA Usaku <usa@ruby-lang.org> + + * ext/socket/socket.c (s_recv, s_recvfrom): some systems (such as + windows) doesn't set fromlen if the socket is connection-oriented. + reported by Bram Whillock in [ruby-core:10512] [ruby-Bugs#9061] + Tue Apr 3 09:36:55 2007 NAKAMURA Usaku <usa@ruby-lang.org> * ext/openssl/ruby_missing.h: need to include version.h to check diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 9af933968..02690e0dc 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -621,7 +621,7 @@ s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from) rb_raise(rb_eTypeError, "sockaddr size differs - should not happen"); } #endif - if (alen) /* OSX doesn't return a from result for connection-oriented sockets */ + if (alen && alen != sizeof(buf)) /* OSX doesn't return a from result for connection-oriented sockets */ return rb_assoc_new(str, ipaddr((struct sockaddr*)buf, fptr->mode & FMODE_NOREVLOOKUP)); else return rb_assoc_new(str, Qnil); @@ -686,7 +686,7 @@ s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from) return str; case RECV_IP: - if (alen) /* connection-oriented socket may not return a from result */ + if (alen && alen != sizeof(buf)) /* connection-oriented socket may not return a from result */ addr = ipaddr((struct sockaddr*)buf, fptr->mode & FMODE_NOREVLOOKUP); break; |