mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ignore failure on unsupported fcntl to drop non-blocking mode
This commit is contained in:
parent
4fe7f270ce
commit
8b32191a31
Notes:
git
2020-12-16 17:55:11 +09:00
1 changed files with 6 additions and 2 deletions
8
ruby.c
8
ruby.c
|
@ -2244,9 +2244,13 @@ open_load_file(VALUE fname_v, int *xflag)
|
|||
rb_update_max_fd(fd);
|
||||
|
||||
#if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY
|
||||
# ifdef ENOTSUP
|
||||
# define IS_SUPPORTED_OP(e) ((e) != ENOTSUP)
|
||||
# else
|
||||
# define IS_SUPPORTED_OP(e) ((void)(e), 1)
|
||||
# endif
|
||||
/* disabling O_NONBLOCK */
|
||||
if (fcntl(fd, F_SETFL, 0) < 0) {
|
||||
e = errno;
|
||||
if (fcntl(fd, F_SETFL, 0) < 0 && IS_SUPPORTED_OP(e = errno)) {
|
||||
(void)close(fd);
|
||||
rb_load_fail(fname_v, strerror(e));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue