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

ruby-changes:40077

From: kosaki <ko1@a...>
Date: Sun, 18 Oct 2015 09:33:51 +0900 (JST)
Subject: [ruby-changes:40077] kosaki:r52158 (trunk): * file.c (ruby_is_fd_loadable): this should be fail if st_mode is

kosaki	2015-10-18 09:33:44 +0900 (Sun, 18 Oct 2015)

  New Revision: 52158

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

  Log:
    * file.c (ruby_is_fd_loadable): this should be fail if st_mode is
      not regular file nor FIFO.

  Modified files:
    trunk/ChangeLog
    trunk/file.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52157)
+++ ChangeLog	(revision 52158)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Oct 18 09:32:58 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* file.c (ruby_is_fd_loadable): this should be fail if st_mode is
+	  not regular file nor FIFO.
+
 Sun Oct 18 09:20:17 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.
Index: file.c
===================================================================
--- file.c	(revision 52157)
+++ file.c	(revision 52158)
@@ -5680,13 +5680,17 @@ ruby_is_fd_loadable(int fd) https://github.com/ruby/ruby/blob/trunk/file.c#L5680
 
     if (fstat(fd, &st) < 0)
 	return 0;
-
     if (S_ISREG(st.st_mode))
 	return 1;
-    if (!S_ISDIR(st.st_mode))
+
+    if (S_ISFIFO(st.st_mode))
 	return 1;
 
-    errno = EISDIR;
+    if (S_ISDIR(st.st_mode))
+	errno = EISDIR;
+    else
+	errno = ENXIO;
+
     return 0;
 #endif
 }

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

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