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

ruby-changes:40073

From: nobu <ko1@a...>
Date: Sun, 18 Oct 2015 08:41:23 +0900 (JST)
Subject: [ruby-changes:40073] nobu:r52154 (trunk): file.c: set errno

nobu	2015-10-18 08:41:14 +0900 (Sun, 18 Oct 2015)

  New Revision: 52154

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

  Log:
    file.c: set errno
    
    * file.c (ruby_is_fd_loadable): set proper errno.

  Modified files:
    trunk/file.c
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 52153)
+++ ruby.c	(revision 52154)
@@ -1803,8 +1803,9 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1803
 	}
 #endif
 	if (!ruby_is_fd_loadable(fd)) {
+	    int e = errno;
 	    (void)close(fd);
-	    rb_load_fail(fname_v, strerror(errno));
+	    rb_load_fail(fname_v, strerror(e));
 	}
 
 	f = rb_io_fdopen(fd, mode, fname);
Index: file.c
===================================================================
--- file.c	(revision 52153)
+++ file.c	(revision 52154)
@@ -5683,9 +5683,10 @@ ruby_is_fd_loadable(int fd) https://github.com/ruby/ruby/blob/trunk/file.c#L5683
 
     if (S_ISREG(st.st_mode))
 	return 1;
-    if (S_ISFIFO(st.st_mode))
+    if (!S_ISDIR(st.st_mode))
 	return 1;
 
+    errno = EISDIR;
     return 0;
 #endif
 }

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

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