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 | 32dd2c47a56e9d310be8258ce5ede8470fc5ce93 (patch) | |
tree | 01f5db3d549547f5781831b9818b7dedc82ce277 /ext/socket/getaddrinfo.c | |
parent | c4d9a1a306d61434f4851a4c08ebc85b3fe04410 (diff) |
* 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/branches/ruby_1_8@21505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/getaddrinfo.c')
-rw-r--r-- | ext/socket/getaddrinfo.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index 43034a3fd8..b5729a4dce 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -39,6 +39,9 @@ */ #include "config.h" +#ifdef RUBY_EXTCONF_H +#include RUBY_EXTCONF_H +#endif #include <sys/types.h> #if !defined(_WIN32) && !defined(__VMS) #include <sys/param.h> @@ -199,7 +202,8 @@ if (pai->ai_flags & AI_CANONNAME) {\ #define ERR(err) { error = (err); goto bad; } -#if defined __UCLIBC__ +#ifndef HAVE_GAI_STRERROR +#ifdef GAI_STRERROR_CONST const #endif char * @@ -210,6 +214,7 @@ gai_strerror(ecode) ecode = EAI_MAX; return (char *)ai_errlist[ecode]; } +#endif void freeaddrinfo(ai) @@ -388,7 +393,7 @@ getaddrinfo(hostname, servname, hints, res) port = htons((unsigned short)atoi(servname)); } else { struct servent *sp; - char *proto; + const char *proto; proto = NULL; switch (pai->ai_socktype) { |