diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-07 16:33:01 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-07 16:33:01 +0000 |
commit | db128e1b31f3c31e955a9063d027a97dcb938873 (patch) | |
tree | 8fae5a1140049d13043e01a4bd2c7358d2807a5d /ext/socket | |
parent | 3ec9537664b3555609bccd0bdf54fa25040a2aeb (diff) | |
download | ruby-db128e1b31f3c31e955a9063d027a97dcb938873.tar.gz |
* bignum.c (bignorm): fixed a bug in normalizing negative numbers
reported from Honda Hiroki <hhonda@ipflex.com>. normalizing
should not trim preceding zeros from negative numbers.
* ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from
KUBO Takehiro <kubo@jiubao.org> to support AIX. [ruby-list:40832]
* lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from
Tilman Sauerbeck <tilman@code-monkey.de>. [ruby-core:05055]
* lib/yaml/rubytypes.rb (Hash::to_yaml): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/extconf.rb | 9 | ||||
-rw-r--r-- | ext/socket/socket.c | 26 |
2 files changed, 33 insertions, 2 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 5e439401ce..747bb35296 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -155,8 +155,13 @@ main() } for (ai = aitop; ai; ai = ai->ai_next) { if (ai->ai_family == AF_LOCAL) continue; - if (ai->ai_addr == NULL || - ai->ai_addrlen == 0 || + if (ai->ai_addr == NULL) + goto bad; +#if defined(_AIX) + ai->ai_addr->sa_len = ai->ai_addrlen; + ai->ai_addr->sa_family = ai->ai_family; +#endif + if (ai->ai_addrlen == 0 || getnameinfo(ai->ai_addr, ai->ai_addrlen, straddr, sizeof(straddr), strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { diff --git a/ext/socket/socket.c b/ext/socket/socket.c index d4fd620a00..867088f084 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -169,6 +169,30 @@ ruby_getaddrinfo(nodename, servname, hints, res) #define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res)) #endif +#if defined(_AIX) +static int +ruby_getaddrinfo__aix(nodename, servname, hints, res) + char *nodename; + char *servname; + struct addrinfo *hints; + struct addrinfo **res; +{ + int error = getaddrinfo(nodename, servname, hints, res); + struct addrinfo *r; + if (error) + return error; + for (r = *res; r != NULL; r = r->ai_next) { + if (r->ai_addr->sa_family == 0) + r->ai_addr->sa_family = r->ai_family; + if (r->ai_addr->sa_len == 0) + r->ai_addr->sa_len = r->ai_addrlen; + } + return 0; +} +#undef getaddrinfo +#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res)) +#endif + #ifdef HAVE_CLOSESOCKET #undef close #define close closesocket @@ -2504,7 +2528,9 @@ sock_s_getnameinfo(argc, argv) * 4th element holds numeric form, don't resolve. * see ipaddr(). */ +#ifdef AI_NUMERICHOST /* AIX 4.3.3 doesn't have AI_NUMERICHOST. */ hints.ai_flags |= AI_NUMERICHOST; +#endif } } else { |