summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-25 06:06:08 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-25 06:06:08 +0000
commitc5ffd3b2dff17657cd0c7ab426a972f1fbfbae6c (patch)
tree93ff972814bffcb9b05fdb355090798abe3fec28
parentc7b600687e37f360ee0cee91675c834f0c53f6cf (diff)
merge revision(s) 21505:
* 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_7@22619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ext/socket/extconf.rb13
-rw-r--r--ext/socket/getaddrinfo.c9
-rw-r--r--version.h2
4 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 550497b673..1ee94717d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Feb 25 15:05:48 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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]
+
Wed Feb 25 14:57:18 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (open_dir_handle): extracted from rb_w32_opendir.
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 8a13ddba73..ece615865f 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -259,6 +259,19 @@ unless getaddr_info_ok and have_func("getnameinfo", "netdb.h") and have_func("ge
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 9fb4ebcb06..9b82296dba 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) {
diff --git a/version.h b/version.h
index 0d292d4b66..87413cd671 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2009-02-25"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20090225
-#define RUBY_PATCHLEVEL 142
+#define RUBY_PATCHLEVEL 143
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8