summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-15 23:17:23 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-16 17:54:43 +0900
commit8b32191a3101cb6441fc64c87cfd011fdadc6867 (patch)
treefecae7fc9f90166a887b1c62b85687d58e989a93 /ruby.c
parent4fe7f270ce924b6339e9ccf56c3fff2de3f4fa8b (diff)
Ignore failure on unsupported fcntl to drop non-blocking mode
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3913
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index fc9adf7..aa6d4a2 100644
--- a/ruby.c
+++ b/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));
}