diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/socket/socket.c | 6 |
2 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Wed Jun 23 22:19:10 2004 Dave Thomas <dave@pragprog.com> + + * ext/socket/socket.c (sock_s_gethostbyaddr): Work around problem + with OS X not returning 'from' parameter to recvfrom for + connection-oriented sockets. + Wed Jun 23 22:16:16 2004 Michal Rokos <michal@ruby-lang.org> * io.c: io_seek()'s retval should be checked [ruby-core:03045] diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 264b3fd731..42c4938c6d 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -492,7 +492,11 @@ s_recvfrom(sock, argc, argv, from) rb_raise(rb_eTypeError, "sockaddr size differs - should not happen"); } #endif - return rb_assoc_new(str, ipaddr((struct sockaddr*)buf, fptr->mode & FMODE_NOREVLOOKUP)); + if (alen) /* 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); + #ifdef HAVE_SYS_UN_H case RECV_UNIX: return rb_assoc_new(str, unixaddr((struct sockaddr_un*)buf)); |