diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-08 13:45:50 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-08 13:45:50 +0000 |
commit | c9ef4fc52faa92a884afaa4b8516431c9b6769f2 (patch) | |
tree | 795f8bd3013f66439872b688ea8d1ab90cecd40a /ext/socket/socket.c | |
parent | 20f786810655ef7ad130f58f8593d3214d146c4b (diff) | |
download | ruby-c9ef4fc52faa92a884afaa4b8516431c9b6769f2.tar.gz |
* ext/socket/socket.c: don't use AI_NUMERICSERV for platforms which
not define it as old Windows.
[ruby-dev:37736]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index f5c6974ba2..8fec480844 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1145,7 +1145,9 @@ port_str(VALUE port, char *pbuf, size_t len, int *flags_ptr) } else if (FIXNUM_P(port)) { snprintf(pbuf, len, "%ld", FIX2LONG(port)); +#ifdef AI_NUMERICSERV if (flags_ptr) *flags_ptr |= AI_NUMERICSERV; +#endif return pbuf; } else { @@ -4020,15 +4022,20 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self) VALUE service = rb_ary_entry(sockaddr_ary, 1); VALUE nodename = rb_ary_entry(sockaddr_ary, 2); VALUE numericnode = rb_ary_entry(sockaddr_ary, 3); + int flags; service = INT2NUM(NUM2INT(service)); if (!NIL_P(nodename)) StringValue(nodename); StringValue(numericnode); + flags = AI_NUMERICHOST; +#ifdef AI_NUMERICSERV + flags |= AI_NUMERICSERV; +#endif init_addrinfo_getaddrinfo(rai, numericnode, service, INT2NUM(i_pfamily ? i_pfamily : af), INT2NUM(i_socktype), INT2NUM(i_protocol), - INT2NUM(AI_NUMERICHOST|AI_NUMERICSERV), + INT2NUM(flags), rb_str_equal(numericnode, nodename) ? Qnil : make_inspectname(nodename, service)); break; } |