diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-10 17:39:07 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-10 17:39:07 +0000 |
commit | b07337fcb3a26397203a2c98f1b20d0d99dce946 (patch) | |
tree | a3cba769384a456a7280e14223e136f5cba618a8 /ext/socket/socket.c | |
parent | 60c8435e1f775ff27e81cac5a84a28f7d0f6319a (diff) | |
download | ruby-b07337fcb3a26397203a2c98f1b20d0d99dce946.tar.gz |
* configure.in: install rdoc by default. if you do not want to
install rdoc, specify --disable-install-doc.
* eval.c (eval): need to add message delimiter. [ruby-dev:22561]
* defines.h (__NeXT__): Ensure that all standard S_IRUSR, S_IWGRP,
S_IRWXO, etc. macros are defined since future code might require
them (even though present code only requires a subset).
* defines.h (__NeXT__): Bug fix: WORDS_BIGENDIAN was not being set
correctly on Rhapsody when -arch compiler flag was used (via
configure's --enable-fat-binary option).
* ext/socket/socket.c (make_hostent): getaddrinfo(3) on BSD do not
fill ai_canonname if serv is not supplied. (ruby-bugs PR#1243)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 8a1825d795..61036061e3 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1036,27 +1036,32 @@ make_hostent(addr, ipaddr) char **pch; ary = rb_ary_new(); - rb_ary_push(ary, rb_str_new2(addr->ai_canonname)); + if (addr->ai_canonname) { + rb_ary_push(ary, rb_str_new2(addr->ai_canonname)); + } + else { + rb_ary_push(ary, Qnil); + } + if (addr->ai_canonname) { #if defined(HAVE_GETIPNODEBYNAME) - { int error; h = getipnodebyname(addr->ai_canonname, addr->ai_family, AI_ALL, &error); - } #elif defined(HAVE_GETHOSTBYNAME2) - h = gethostbyname2(addr->ai_canonname, addr->ai_family); + h = gethostbyname2(addr->ai_canonname, addr->ai_family); #else - h = gethostbyname(addr->ai_canonname); + h = gethostbyname(addr->ai_canonname); #endif - 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 (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 { |