* 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
This commit is contained in:
akr 2009-01-08 13:45:50 +00:00
parent 20f7868106
commit c9ef4fc52f
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Thu Jan 8 22:44:10 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/socket.c: don't use AI_NUMERICSERV for platforms which
not define it as old Windows.
[ruby-dev:37736]
Thu Jan 8 17:32:51 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Jan 8 17:32:51 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* instruby.rb: should not depend on a library which does not exist * instruby.rb: should not depend on a library which does not exist

View File

@ -1145,7 +1145,9 @@ port_str(VALUE port, char *pbuf, size_t len, int *flags_ptr)
} }
else if (FIXNUM_P(port)) { else if (FIXNUM_P(port)) {
snprintf(pbuf, len, "%ld", FIX2LONG(port)); snprintf(pbuf, len, "%ld", FIX2LONG(port));
#ifdef AI_NUMERICSERV
if (flags_ptr) *flags_ptr |= AI_NUMERICSERV; if (flags_ptr) *flags_ptr |= AI_NUMERICSERV;
#endif
return pbuf; return pbuf;
} }
else { else {
@ -4020,15 +4022,20 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self)
VALUE service = rb_ary_entry(sockaddr_ary, 1); VALUE service = rb_ary_entry(sockaddr_ary, 1);
VALUE nodename = rb_ary_entry(sockaddr_ary, 2); VALUE nodename = rb_ary_entry(sockaddr_ary, 2);
VALUE numericnode = rb_ary_entry(sockaddr_ary, 3); VALUE numericnode = rb_ary_entry(sockaddr_ary, 3);
int flags;
service = INT2NUM(NUM2INT(service)); service = INT2NUM(NUM2INT(service));
if (!NIL_P(nodename)) if (!NIL_P(nodename))
StringValue(nodename); StringValue(nodename);
StringValue(numericnode); StringValue(numericnode);
flags = AI_NUMERICHOST;
#ifdef AI_NUMERICSERV
flags |= AI_NUMERICSERV;
#endif
init_addrinfo_getaddrinfo(rai, numericnode, service, init_addrinfo_getaddrinfo(rai, numericnode, service,
INT2NUM(i_pfamily ? i_pfamily : af), INT2NUM(i_socktype), INT2NUM(i_protocol), 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)); rb_str_equal(numericnode, nodename) ? Qnil : make_inspectname(nodename, service));
break; break;
} }