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
This commit is contained in:
parent
34b877e491
commit
4bc884c4f3
2
io.c
2
io.c
@ -4981,7 +4981,7 @@ rb_io_oflags_fmode(int oflags)
|
|||||||
{
|
{
|
||||||
int fmode = 0;
|
int fmode = 0;
|
||||||
|
|
||||||
switch (oflags & (O_RDONLY|O_WRONLY|O_RDWR)) {
|
switch (oflags & O_ACCMODE) {
|
||||||
case O_RDONLY:
|
case O_RDONLY:
|
||||||
fmode = FMODE_READABLE;
|
fmode = FMODE_READABLE;
|
||||||
break;
|
break;
|
||||||
|
8
ruby.c
8
ruby.c
@ -43,6 +43,9 @@
|
|||||||
#ifndef MAXPATHLEN
|
#ifndef MAXPATHLEN
|
||||||
# define MAXPATHLEN 1024
|
# define MAXPATHLEN 1024
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef O_ACCMODE
|
||||||
|
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ruby/util.h"
|
#include "ruby/util.h"
|
||||||
|
|
||||||
@ -1739,9 +1742,10 @@ load_file_internal(VALUE arg)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int fd, mode = O_RDONLY;
|
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;
|
mode |= O_NONBLOCK;
|
||||||
#elif defined O_NDELAY
|
#elif defined O_NDELAY && !(O_NDELAY & O_ACCMODE)
|
||||||
mod |= O_NDELAY;
|
mod |= O_NDELAY;
|
||||||
#endif
|
#endif
|
||||||
#if defined DOSISH || defined __CYGWIN__
|
#if defined DOSISH || defined __CYGWIN__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user