ruby-changes:14899
From: mame <ko1@a...>
Date: Fri, 26 Feb 2010 21:06:36 +0900 (JST)
Subject: [ruby-changes:14899] Ruby:r26768 (trunk): * ext/socket/raddrinfo.c, ext/socket/udpsocket.c: avoid illegal cast
mame 2010-02-26 21:06:17 +0900 (Fri, 26 Feb 2010) New Revision: 26768 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26768 Log: * ext/socket/raddrinfo.c, ext/socket/udpsocket.c: avoid illegal cast from void-returning function to VALUE-returning one. It causes SEGV on RubySpec with mingw32. Modified files: trunk/ChangeLog trunk/ext/socket/raddrinfo.c trunk/ext/socket/udpsocket.c Index: ChangeLog =================================================================== --- ChangeLog (revision 26767) +++ ChangeLog (revision 26768) @@ -1,3 +1,9 @@ +Fri Feb 26 20:51:47 2010 Yusuke Endoh <mame@t...> + + * ext/socket/raddrinfo.c, ext/socket/udpsocket.c: avoid illegal cast + from void-returning function to VALUE-returning one. It causes SEGV + on RubySpec with mingw32. + Fri Feb 26 20:07:48 2010 Tanaka Akira <akr@f...> * pack.c (QUAD_SIZE): it should be always 8. Index: ext/socket/udpsocket.c =================================================================== --- ext/socket/udpsocket.c (revision 26767) +++ ext/socket/udpsocket.c (revision 26768) @@ -62,6 +62,8 @@ return Qfalse; } +VALUE rsock_freeaddrinfo(struct addrinfo *addr); + /* * call-seq: * udpsocket.connect(host, port) => 0 @@ -90,7 +92,7 @@ GetOpenFile(sock, fptr); arg.fd = fptr->fd; ret = rb_ensure(udp_connect_internal, (VALUE)&arg, - RUBY_METHOD_FUNC(freeaddrinfo), (VALUE)arg.res); + rsock_freeaddrinfo, (VALUE)arg.res); if (!ret) rb_sys_fail("connect(2)"); return INT2FIX(0); } Index: ext/socket/raddrinfo.c =================================================================== --- ext/socket/raddrinfo.c (revision 26767) +++ ext/socket/raddrinfo.c (revision 26768) @@ -457,6 +457,13 @@ } VALUE +rsock_freeaddrinfo(struct addrinfo *addr) +{ + freeaddrinfo(addr); + return Qnil; +} + +VALUE rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, size_t)) { struct hostent_arg arg; @@ -465,7 +472,7 @@ arg.addr = addr; arg.ipaddr = ipaddr; return rb_ensure(make_hostent_internal, (VALUE)&arg, - RUBY_METHOD_FUNC(freeaddrinfo), (VALUE)addr); + rsock_freeaddrinfo, (VALUE)addr); } typedef struct { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/