1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2010-02-26 12:06:17 +00:00
parent 07298aba22
commit 785f417270
3 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Fri Feb 26 20:51:47 2010 Yusuke Endoh <mame@tsg.ne.jp>
* 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@fsij.org>
* pack.c (QUAD_SIZE): it should be always 8.

View file

@ -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 {

View file

@ -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);
}