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

ruby-changes:33451

From: akr <ko1@a...>
Date: Mon, 7 Apr 2014 21:14:35 +0900 (JST)
Subject: [ruby-changes:33451] akr:r45530 (trunk): * ext/socket/socket.c (sock_s_getnameinfo): Save errno for EAI_SYSTEM.

akr	2014-04-07 21:14:29 +0900 (Mon, 07 Apr 2014)

  New Revision: 45530

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

  Log:
    * ext/socket/socket.c (sock_s_getnameinfo): Save errno for EAI_SYSTEM.
      Reported by Saravana kumar.  [ruby-core:61820] [Bug #9697]
      Fixed by Heesob Park.  [ruby-core:61868]

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/socket.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45529)
+++ ChangeLog	(revision 45530)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Apr  7 21:11:49 2014  Tanaka Akira  <akr@f...>
+
+	* ext/socket/socket.c (sock_s_getnameinfo): Save errno for EAI_SYSTEM.
+	  Reported by Saravana kumar.  [ruby-core:61820] [Bug #9697]
+	  Fixed by Heesob Park.  [ruby-core:61868]
+
 Mon Apr  7 07:20:23 2014  NARUSE, Yui  <naruse@r...>
 
 	* lib/xmlrpc/client.rb (do_rpc): don't check body length.
Index: ext/socket/socket.c
===================================================================
--- ext/socket/socket.c	(revision 45529)
+++ ext/socket/socket.c	(revision 45530)
@@ -1346,7 +1346,7 @@ sock_s_getnameinfo(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1346
     int fl;
     struct rb_addrinfo *res = NULL;
     struct addrinfo hints, *r;
-    int error;
+    int error, saved_errno;
     union_sockaddr ss;
     struct sockaddr *sap;
     socklen_t salen;
@@ -1460,11 +1460,15 @@ sock_s_getnameinfo(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1460
     return rb_assoc_new(rb_str_new2(hbuf), rb_str_new2(pbuf));
 
   error_exit_addr:
+    saved_errno = errno;
     if (res) rb_freeaddrinfo(res);
+    errno = saved_errno;
     rsock_raise_socket_error("getaddrinfo", error);
 
   error_exit_name:
+    saved_errno = errno;
     if (res) rb_freeaddrinfo(res);
+    errno = saved_errno;
     rsock_raise_socket_error("getnameinfo", error);
 
     UNREACHABLE;

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

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