* file.c (ruby_is_fd_loadable): this should be fail if st_mode is
not regular file nor FIFO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
698f6648c5
commit
21704f2269
@ -1,3 +1,8 @@
|
|||||||
|
Sun Oct 18 09:32:58 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* 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@gmail.com>
|
Sun Oct 18 09:20:17 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.
|
* ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.
|
||||||
|
10
file.c
10
file.c
@ -5680,13 +5680,17 @@ ruby_is_fd_loadable(int fd)
|
|||||||
|
|
||||||
if (fstat(fd, &st) < 0)
|
if (fstat(fd, &st) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (S_ISREG(st.st_mode))
|
if (S_ISREG(st.st_mode))
|
||||||
return 1;
|
return 1;
|
||||||
if (!S_ISDIR(st.st_mode))
|
|
||||||
|
if (S_ISFIFO(st.st_mode))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
errno = EISDIR;
|
if (S_ISDIR(st.st_mode))
|
||||||
|
errno = EISDIR;
|
||||||
|
else
|
||||||
|
errno = ENXIO;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user