mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
O_NONBLOCK
is not always a preprocessor constant on all platforms
This commit is contained in:
parent
4cd6fd338f
commit
2dff82bfca
Notes:
git
2022-01-16 23:47:30 +09:00
Merged: https://github.com/ruby/ruby/pull/5454 Merged-By: nobu <nobu@ruby-lang.org>
1 changed files with 7 additions and 6 deletions
13
ruby.c
13
ruby.c
|
@ -2323,14 +2323,15 @@ open_load_file(VALUE fname_v, int *xflag)
|
|||
int fd;
|
||||
/* open(2) may block if fname is point to FIFO and it's empty. Let's
|
||||
use O_NONBLOCK. */
|
||||
#if defined O_NONBLOCK && HAVE_FCNTL && !(O_NONBLOCK & O_ACCMODE)
|
||||
const int MODE_TO_LOAD = O_RDONLY | (
|
||||
#if defined O_NONBLOCK && HAVE_FCNTL
|
||||
/* TODO: fix conflicting O_NONBLOCK in ruby/win32.h */
|
||||
# define MODE_TO_LOAD (O_RDONLY | O_NONBLOCK)
|
||||
#elif defined O_NDELAY && HAVE_FCNTL && !(O_NDELAY & O_ACCMODE)
|
||||
# define MODE_TO_LOAD (O_RDONLY | O_NDELAY)
|
||||
#else
|
||||
# define MODE_TO_LOAD (O_RDONLY)
|
||||
!(O_NONBLOCK & O_ACCMODE) ? O_NONBLOCK :
|
||||
#endif
|
||||
#if defined O_NDELAY && HAVE_FCNTL
|
||||
!(O_NDELAY & O_ACCMODE) ? O_NDELAY :
|
||||
#endif
|
||||
0);
|
||||
int mode = MODE_TO_LOAD;
|
||||
#if defined DOSISH || defined __CYGWIN__
|
||||
# define isdirsep(x) ((x) == '/' || (x) == '\\')
|
||||
|
|
Loading…
Reference in a new issue