ruby-changes:59767
From: Nobuyoshi <ko1@a...>
Date: Tue, 21 Jan 2020 22:46:55 +0900 (JST)
Subject: [ruby-changes:59767] 5798d35ff6 (master): Also check EWOULDBLOCK as well as EAGAIN
https://git.ruby-lang.org/ruby.git/commit/?id=5798d35ff6 From 5798d35ff66e468ebf296c4069ede275d7fb0ec9 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 21 Jan 2020 22:45:10 +0900 Subject: Also check EWOULDBLOCK as well as EAGAIN diff --git a/io.c b/io.c index 51d92a9..201ec9b 100755 --- a/io.c +++ b/io.c @@ -316,7 +316,6 @@ rb_cloexec_open(const char *pathname, int flags, mode_t mode) https://github.com/ruby/ruby/blob/trunk/io.c#L316 static const int retry_max_count = 10000; int retry_count = 0; - int e; #ifdef O_CLOEXEC /* O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ @@ -325,15 +324,11 @@ rb_cloexec_open(const char *pathname, int flags, mode_t mode) https://github.com/ruby/ruby/blob/trunk/io.c#L324 flags |= O_NOINHERIT; #endif - while (1) { - ret = open(pathname, flags, mode); - e = errno; - - if (ret != -1 || e != EAGAIN || retry_count >= retry_max_count) { - break; - } + while ((ret = open(pathname, flags, mode)) == -1) { + int e = errno; + if (e != EAGAIN && e != EWOULDBLOCK) break; + if (retry_count++ >= retry_max_count) break; - retry_count++; sleep(retry_interval); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/