ruby-changes:70909
From: Nobuyoshi <ko1@a...>
Date: Sun, 16 Jan 2022 23:47:21 +0900 (JST)
Subject: [ruby-changes:70909] 2dff82bfca (master): `O_NONBLOCK` is not always a preprocessor constant on all platforms
https://git.ruby-lang.org/ruby.git/commit/?id=2dff82bfca From 2dff82bfca0226e335a446715b94670b5af85108 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 16 Jan 2022 23:47:10 +0900 Subject: `O_NONBLOCK` is not always a preprocessor constant on all platforms --- ruby.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ruby.c b/ruby.c index 8747b842d3c..747934e6d1e 100644 --- a/ruby.c +++ b/ruby.c @@ -2323,14 +2323,15 @@ open_load_file(VALUE fname_v, int *xflag) https://github.com/ruby/ruby/blob/trunk/ruby.c#L2323 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) == '\\') -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/