summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2024-03-31 17:16:26 +0900
committernagachika <nagachika@ruby-lang.org>2024-03-31 17:16:26 +0900
commitbf6e9299ef4f10dbd23f32331c355ac875bfb5e3 (patch)
tree05ca549941916a87f96726cfb20185f2504e5569
parentd5dbada8a2127d9b6b670dd891eabbb63c48268f (diff)
merge revision(s) 2554c5d3b8738a248cedb2fea96dfab9fbe19417: [Backport #20231]
Don't wait in `io_binwrite_string` if not necessary. (#9792) --- io.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
-rw-r--r--io.c8
-rw-r--r--version.h2
2 files changed, 4 insertions, 6 deletions
diff --git a/io.c b/io.c
index 4caf771b05..0c5bbf0cb4 100644
--- a/io.c
+++ b/io.c
@@ -1789,13 +1789,11 @@ io_binwrite_string(VALUE arg)
// Write as much as possible:
ssize_t result = io_binwrite_string_internal(p->fptr, ptr, remaining);
- // If only the internal buffer is written, result will be zero [bytes of given data written]. This means we
- // should try again.
if (result == 0) {
- errno = EWOULDBLOCK;
+ // If only the internal buffer is written, result will be zero [bytes of given data written]. This means we
+ // should try again immediately.
}
-
- if (result > 0) {
+ else if (result > 0) {
if ((size_t)result == remaining) break;
ptr += result;
remaining -= result;
diff --git a/version.h b/version.h
index ef3bee1af1..14bd9775ae 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 3
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 161
+#define RUBY_PATCHLEVEL 162
#include "ruby/version.h"
#include "ruby/internal/abi.h"