mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
file.c: set errno
* file.c (ruby_is_fd_loadable): set proper errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d5cb997f18
commit
d6379666ca
2 changed files with 4 additions and 2 deletions
3
file.c
3
file.c
|
@ -5683,9 +5683,10 @@ ruby_is_fd_loadable(int fd)
|
|||
|
||||
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
|
||||
}
|
||||
|
|
3
ruby.c
3
ruby.c
|
@ -1803,8 +1803,9 @@ open_load_file(VALUE fname_v, int *xflag)
|
|||
}
|
||||
#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);
|
||||
|
|
Loading…
Reference in a new issue