diff --git a/ChangeLog b/ChangeLog index a37d3f92e0..f7e7552923 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Feb 26 20:51:47 2010 Yusuke Endoh + + * 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 * pack.c (QUAD_SIZE): it should be always 8. diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index de8c7dc768..822ab1718a 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -456,6 +456,13 @@ make_hostent_internal(struct hostent_arg *arg) return ary; } +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)) { @@ -465,7 +472,7 @@ rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct soc 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 { diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c index 8abed48376..8638d81a80 100644 --- a/ext/socket/udpsocket.c +++ b/ext/socket/udpsocket.c @@ -62,6 +62,8 @@ udp_connect_internal(struct udp_arg *arg) return Qfalse; } +VALUE rsock_freeaddrinfo(struct addrinfo *addr); + /* * call-seq: * udpsocket.connect(host, port) => 0 @@ -90,7 +92,7 @@ udp_connect(VALUE sock, VALUE host, VALUE port) 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); }