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

ruby-changes:21642

From: nobu <ko1@a...>
Date: Wed, 9 Nov 2011 23:21:43 +0900 (JST)
Subject: [ruby-changes:21642] nobu:r33691 (trunk): * io.c (rb_update_max_fd): fstat(2) can fail with other than

nobu	2011-11-09 23:20:27 +0900 (Wed, 09 Nov 2011)

  New Revision: 33691

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

  Log:
    * io.c (rb_update_max_fd): fstat(2) can fail with other than
      EBADF.  [ruby-dev:44837] [Backport #4339].  Cf.
      http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33690)
+++ ChangeLog	(revision 33691)
@@ -1,5 +1,9 @@
-Wed Nov  9 22:54:30 2011  Nobuyoshi Nakada  <nobu@r...>
+Wed Nov  9 23:20:22 2011  Nobuyoshi Nakada  <nobu@r...>
 
+	* io.c (rb_update_max_fd): fstat(2) can fail with other than
+	  EBADF.  [ruby-dev:44837] [Backport #4339].  Cf.
+	  http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html
+
 	* io.c (rb_sysopen): max fd is updated in rb_sysopen_internal()
 	  already.
 
Index: io.c
===================================================================
--- io.c	(revision 33690)
+++ io.c	(revision 33691)
@@ -151,7 +151,7 @@
 rb_update_max_fd(int fd)
 {
     struct stat buf;
-    if (fstat(fd, &buf) != 0) {
+    if (fstat(fd, &buf) != 0 && errno == EBADF) {
         rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
     }
     if (max_file_descriptor < fd) max_file_descriptor = fd;

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

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