summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-20 02:06:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-20 02:06:42 +0000
commite75c34c2e9f9e1c629cdab13c0c400494f49adb7 (patch)
tree7cc376d79d80b16b340be2219a6f80e69826a303 /ext/socket
parent0014687097c3c0ce8e728496ad7fa777372ea7fb (diff)
* gc.c (gc_sweep): loosen page free condition to avoid add_heap()
race condition. [ruby-dev:21633] * gc.c (gc_sweep): do not update malloc_limit when malloc_increase is smaller than malloc_limit. * ext/socket/socket.c (make_hostent): h_aliases may be NULL. (ruby-bugs PR#1195) * ext/socket/socket.c (sock_s_gethostbyaddr): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/socket.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 95ec45bfe6..aa568cf6b3 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1046,8 +1046,10 @@ make_hostent(addr, ipaddr)
#else
h = gethostbyname(addr->ai_canonname);
#endif
- for (pch = h->h_aliases; *pch; pch++) {
- rb_ary_push(names, rb_str_new2(*pch));
+ 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);
@@ -2022,8 +2024,10 @@ sock_s_gethostbyaddr(argc, argv)
rb_ary_push(ary, rb_str_new2(h->h_name));
names = rb_ary_new();
rb_ary_push(ary, names);
- for (pch = h->h_aliases; *pch; pch++) {
- rb_ary_push(names, rb_str_new2(*pch));
+ if (h->h_aliases != NULL) {
+ for (pch = h->h_aliases; *pch; pch++) {
+ rb_ary_push(names, rb_str_new2(*pch));
+ }
}
rb_ary_push(ary, INT2NUM(h->h_addrtype));
#ifdef h_addr