diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-14 04:09:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-14 04:09:05 +0000 |
commit | f188bf2acb3aef0a6525500a84bf38b1fa6d2a3f (patch) | |
tree | 931fc3d39d191eaa0842633e028a1de0ebc1b480 /ext | |
parent | 96a49b1ada2ca59e039d05b539d05643c6d74fc2 (diff) | |
download | ruby-f188bf2acb3aef0a6525500a84bf38b1fa6d2a3f.tar.gz |
* ext/socket/extconf.rb (gai_strerror): checks if available and if
returns const pointer.
* ext/socket/getaddrinfo.c (gai_strerror): defines only if non
available. [ruby-core:21328]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/socket/extconf.rb | 13 | ||||
-rw-r--r-- | ext/socket/getaddrinfo.c | 7 |
2 files changed, 18 insertions, 2 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 443dd7d21e..4d9f4e43a3 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -255,6 +255,19 @@ unless getaddr_info_ok and have_func("getnameinfo", headers) and have_func("geta have_func("inet_ntop") or have_func("inet_ntoa") have_func("inet_pton") or have_func("inet_aton") have_func("getservbyport") + if have_func("gai_strerror") + unless checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)} +#{cpp_include(headers)} +#include <stdlib.h> +void +conftest_gai_strerror_is_const() +{ + *gai_strerror(0) = 0; +} +EOF + $defs << "-DGAI_STRERROR_CONST" + end + end have_header("arpa/nameser.h") have_header("resolv.h") end diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index ef01a607be..53656b4c02 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -39,6 +39,9 @@ */ #include "ruby/config.h" +#ifdef RUBY_EXTCONF_H +#include RUBY_EXTCONF_H +#endif #include <sys/types.h> #ifndef _WIN32 #include <sys/param.h> @@ -195,8 +198,8 @@ if (pai->ai_flags & AI_CANONNAME) {\ #define ERR(err) { error = (err); goto bad; } -#ifndef __HAIKU__ -#if defined __UCLIBC__ +#ifndef HAVE_GAI_STRERROR +#ifdef GAI_STRERROR_CONST const #endif char * |