mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/socket.c (make_hostent): get rid of SEGV on aliases
lookup failure. (ruby-bugs:PR#1215) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cac6465677
commit
a51b5fa52b
2 changed files with 18 additions and 8 deletions
|
@ -1,7 +1,12 @@
|
|||
Fri Nov 7 10:23:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/socket/socket.c (make_hostent): get rid of SEGV on aliases
|
||||
lookup failure. (ruby-bugs:PR#1215)
|
||||
|
||||
Fri Nov 7 04:08:05 2003 UENO Katsuhiro <katsu@blue.sky.or.jp>
|
||||
|
||||
* ext/zlib/zlib.c (Init_zlib): define Zlib::GzipReader#each_line as
|
||||
an alias of Zlib::GzipReader#each.
|
||||
an alias of Zlib::GzipReader#each.
|
||||
|
||||
Fri Nov 7 01:03:16 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
|
|
|
@ -1033,8 +1033,6 @@ make_hostent(addr, ipaddr)
|
|||
|
||||
ary = rb_ary_new();
|
||||
rb_ary_push(ary, rb_str_new2(addr->ai_canonname));
|
||||
names = rb_ary_new();
|
||||
rb_ary_push(ary, names);
|
||||
#if defined(HAVE_GETIPNODEBYNAME)
|
||||
{
|
||||
int error;
|
||||
|
@ -1046,14 +1044,21 @@ make_hostent(addr, ipaddr)
|
|||
#else
|
||||
h = gethostbyname(addr->ai_canonname);
|
||||
#endif
|
||||
if (h->h_aliases != NULL) {
|
||||
for (pch = h->h_aliases; *pch; pch++) {
|
||||
rb_ary_push(names, rb_str_new2(*pch));
|
||||
if (h) {
|
||||
names = rb_ary_new();
|
||||
if (h->h_aliases != NULL) {
|
||||
for (pch = h->h_aliases; *pch; pch++) {
|
||||
rb_ary_push(names, rb_str_new2(*pch));
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(HAVE_GETIPNODEBYNAME)
|
||||
freehostent(h);
|
||||
freehostent(h);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
names = rb_ary_new2(0);
|
||||
}
|
||||
rb_ary_push(ary, names);
|
||||
rb_ary_push(ary, INT2NUM(addr->ai_family));
|
||||
for (ai = addr; ai; ai = ai->ai_next) {
|
||||
rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen));
|
||||
|
|
Loading…
Reference in a new issue