[前][次][番号順一覧][スレッド一覧]

ruby-changes:29163

From: naruse <ko1@a...>
Date: Mon, 10 Jun 2013 20:59:46 +0900 (JST)
Subject: [ruby-changes:29163] naruse:r41215 (trunk): * ext/socket/raddrinfo.c (nogvl_getaddrinfo): work around for Ubuntu

naruse	2013-06-10 20:59:36 +0900 (Mon, 10 Jun 2013)

  New Revision: 41215

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41215

  Log:
    * ext/socket/raddrinfo.c (nogvl_getaddrinfo): work around for Ubuntu
      13.04's getaddrinfo issue with mdns4. [ruby-list:49420]

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/raddrinfo.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41214)
+++ ChangeLog	(revision 41215)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun 10 20:58:11 2013  NARUSE, Yui  <naruse@r...>
+
+	* ext/socket/raddrinfo.c (nogvl_getaddrinfo): work around for Ubuntu
+	  13.04's getaddrinfo issue with mdns4. [ruby-list:49420]
+
 Mon Jun 10 19:34:39 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (rb_integer_pack): Returns sign instead of words.
Index: ext/socket/raddrinfo.c
===================================================================
--- ext/socket/raddrinfo.c	(revision 41214)
+++ ext/socket/raddrinfo.c	(revision 41215)
@@ -157,9 +157,18 @@ struct getaddrinfo_arg https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L157
 static void *
 nogvl_getaddrinfo(void *arg)
 {
+    int ret;
     struct getaddrinfo_arg *ptr = arg;
-    return (void *)(VALUE)getaddrinfo(ptr->node, ptr->service,
+    getaddrinfo(ptr->node, ptr->service,
 				      ptr->hints, ptr->res);
+#ifdef __linux__
+    /* On Linux (mainly Ubuntu 13.04) /etc/nsswitch.conf has mdns4 and
+     * it cause getaddrinfo to return EAI_SYSTEM/ENOENT. [ruby-list:49420]
+     */
+    if (ret == EAI_SYSTEM && errno == ENOENT)
+	ret = EAI_NONAME;
+#endif
+    return (void *)(VALUE)ret;
 }
 #endif
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]