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

ruby-changes:32562

From: akr <ko1@a...>
Date: Sat, 18 Jan 2014 22:42:44 +0900 (JST)
Subject: [ruby-changes:32562] akr:r44641 (trunk): * io.c (rb_update_max_fd): Return immediately if the given fd is small

akr	2014-01-18 22:42:39 +0900 (Sat, 18 Jan 2014)

  New Revision: 44641

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

  Log:
    * io.c (rb_update_max_fd): Return immediately if the given fd is small
      enough.

  Modified files:
    trunk/ChangeLog
    trunk/io.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44640)
+++ ChangeLog	(revision 44641)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jan 18 22:35:15 2014  Tanaka Akira  <akr@f...>
+
+	* io.c (rb_update_max_fd): Return immediately if the given fd is small
+	  enough.
+
 Sat Jan 18 22:25:53 2014  Tanaka Akira  <akr@f...>
 
 	* io.c: Test O_CLOEXEC only once.
Index: io.c
===================================================================
--- io.c	(revision 44640)
+++ io.c	(revision 44641)
@@ -189,6 +189,9 @@ rb_update_max_fd(int fd) https://github.com/ruby/ruby/blob/trunk/io.c#L189
     struct stat buf;
     rb_atomic_t afd = (rb_atomic_t)fd;
 
+    if (afd <= max_file_descriptor)
+        return;
+
     if (fstat(fd, &buf) != 0 && errno == EBADF) {
         rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
     }

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

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