summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;