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 | eed46ac6337e995196430b18eca10c9cb15317da (patch) | |
tree | ddf143d1605f30fa4f4c2b6550669837ab2138e4 /ext/socket/socket.c | |
parent | 9a41f064fae5245df0a2d9dc7045d5e9705946c8 (diff) | |
download | ruby-eed46ac6337e995196430b18eca10c9cb15317da.tar.gz |
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@12138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 9af933968c..02690e0dcc 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; |