ruby-changes:20550
From: akr <ko1@a...>
Date: Thu, 21 Jul 2011 21:02:56 +0900 (JST)
Subject: [ruby-changes:20550] akr:r32598 (trunk, ruby_1_9_3): * ext/socket/ancdata.c (discard_cmsg): workaround for MacOS X Lion.
akr 2011-07-21 21:02:45 +0900 (Thu, 21 Jul 2011) New Revision: 32598 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32598 Log: * ext/socket/ancdata.c (discard_cmsg): workaround for MacOS X Lion. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/ext/socket/ancdata.c trunk/ChangeLog trunk/ext/socket/ancdata.c Index: ChangeLog =================================================================== --- ChangeLog (revision 32597) +++ ChangeLog (revision 32598) @@ -1,3 +1,7 @@ +Thu Jul 21 20:59:59 2011 Tanaka Akira <akr@f...> + + * ext/socket/ancdata.c (discard_cmsg): workaround for MacOS X Lion. + Thu Jul 21 20:02:11 2011 Yusuke Endoh <mame@t...> * thread.c (set_trace_func, thread_set_trace_func_m): reset tracing Index: ext/socket/ancdata.c =================================================================== --- ext/socket/ancdata.c (revision 32597) +++ ext/socket/ancdata.c (revision 32598) @@ -1384,8 +1384,16 @@ int *end = (int *)((char *)cmh + cmh->cmsg_len); while ((char *)fdp + sizeof(int) <= (char *)end && (char *)fdp + sizeof(int) <= msg_end) { - rb_update_max_fd(*fdp); - close(*fdp); + /* + * xxx: nagachika said *fdp can be invalid fd on MacOS X Lion. + * This workaround using fstat is clearly wrong. + * we should investigate why *fdp contains invalid fd. + */ + struct stat buf; + if (fstat(*fdp, &buf) == 0) { + rb_update_max_fd(*fdp); + close(*fdp); + } fdp++; } } Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 32597) +++ ruby_1_9_3/ChangeLog (revision 32598) @@ -1,3 +1,8 @@ +Thu Jul 21 20:59:59 2011 Tanaka Akira <akr@f...> + + * ext/socket/ancdata.c (discard_cmsg): workaround for MacOS X Lion. + + Thu Jul 21 07:07:57 2011 Tanaka Akira <akr@f...> * backport r32579, r32581, r32587 by akr and r32588 by kazu. Index: ruby_1_9_3/ext/socket/ancdata.c =================================================================== --- ruby_1_9_3/ext/socket/ancdata.c (revision 32597) +++ ruby_1_9_3/ext/socket/ancdata.c (revision 32598) @@ -1384,8 +1384,16 @@ int *end = (int *)((char *)cmh + cmh->cmsg_len); while ((char *)fdp + sizeof(int) <= (char *)end && (char *)fdp + sizeof(int) <= msg_end) { - rb_update_max_fd(*fdp); - close(*fdp); + /* + * xxx: nagachika said *fdp can be invalid fd on MacOS X Lion. + * This workaround using fstat is clearly wrong. + * we should investigate why *fdp contains invalid fd. + */ + struct stat buf; + if (fstat(*fdp, &buf) == 0) { + rb_update_max_fd(*fdp); + close(*fdp); + } fdp++; } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/