summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-03 06:50:41 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-03 06:50:41 +0000
commit1f50a1e4e7ed0c0a2eb33b8f0f21821c80a99930 (patch)
treeddf143d1605f30fa4f4c2b6550669837ab2138e4
parent03613d9255e24a4d9343ec98f99624046f1d3cf2 (diff)
downloadruby-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--ChangeLog6
-rw-r--r--ext/socket/socket.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index bdf7ec495..c1a9f2791 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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;