summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-17 04:03:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-17 04:03:23 +0000
commit4bc884c4f38e9b5221fd66ffbcbcacac5a79719b (patch)
treedfdefaf163b16d0f70475d6aaa7d77dc212c5218 /ruby.c
parent34b877e49166c209e300ee9887f79b26b82821fc (diff)
ruby.c: conflicting O_NONBLOCK
* ruby.c (load_file_internal): do not use O_NONBLOCK when conflicting with O_ACCMODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 8267002..9cb03ee 100644
--- a/ruby.c
+++ b/ruby.c
@@ -43,6 +43,9 @@
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
#include "ruby/util.h"
@@ -1739,9 +1742,10 @@ load_file_internal(VALUE arg)
}
else {
int fd, mode = O_RDONLY;
-#if defined O_NONBLOCK
+#if defined O_NONBLOCK && !(O_NONBLOCK & O_ACCMODE)
+ /* TODO: fix conflicting O_NONBLOCK in ruby/win32.h */
mode |= O_NONBLOCK;
-#elif defined O_NDELAY
+#elif defined O_NDELAY && !(O_NDELAY & O_ACCMODE)
mod |= O_NDELAY;
#endif
#if defined DOSISH || defined __CYGWIN__