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

ruby-changes:27889

From: akr <ko1@a...>
Date: Tue, 26 Mar 2013 23:34:29 +0900 (JST)
Subject: [ruby-changes:27889] akr:r39941 (trunk): * ext/socket/socket.c (sockaddr_len): return the shortest length for

akr	2013-03-26 23:34:20 +0900 (Tue, 26 Mar 2013)

  New Revision: 39941

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

  Log:
    * ext/socket/socket.c (sockaddr_len): return the shortest length for
      unknown socket address.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39940)
+++ ChangeLog	(revision 39941)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Mar 26 22:31:10 2013  Tanaka Akira  <akr@f...>
+
+	* ext/socket/socket.c (sockaddr_len): return the shortest length for
+	  unknown socket address.
+
 Tue Mar 26 22:14:46 2013  Tanaka Akira  <akr@f...>
 
 	* thread.c (double2timeval): convert the infinity to TIME_MAX to avoid
Index: ext/socket/socket.c
===================================================================
--- ext/socket/socket.c	(revision 39940)
+++ ext/socket/socket.c	(revision 39941)
@@ -1512,7 +1512,7 @@ sockaddr_len(struct sockaddr *addr) https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1512
 #endif
 
       default:
-        return (socklen_t)sizeof(struct sockaddr_in);
+        return (socklen_t)(offsetof(struct sockaddr, sa_family) + sizeof(addr->sa_family));
     }
 }
 

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

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