1
0
Fork 0
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:
Nobuyoshi Nakada 2020-12-15 23:17:23 +09:00
parent 4fe7f270ce
commit 8b32191a31
Notes: git 2020-12-16 17:55:11 +09:00

8
ruby.c
View file

@ -2244,9 +2244,13 @@ open_load_file(VALUE fname_v, int *xflag)
rb_update_max_fd(fd); rb_update_max_fd(fd);
#if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY #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 */ /* disabling O_NONBLOCK */
if (fcntl(fd, F_SETFL, 0) < 0) { if (fcntl(fd, F_SETFL, 0) < 0 && IS_SUPPORTED_OP(e = errno)) {
e = errno;
(void)close(fd); (void)close(fd);
rb_load_fail(fname_v, strerror(e)); rb_load_fail(fname_v, strerror(e));
} }