diff options
author | Samuel Williams <[email protected]> | 2022-06-13 15:33:54 +1200 |
---|---|---|
committer | Samuel Williams <[email protected]> | 2022-06-13 16:12:18 +1200 |
commit | 425a46131a029390cd693242e621f6632c76cc42 (patch) | |
tree | b0598d3d71f04cf6c360d27dbbfb9246521d587a /io.c | |
parent | d9ccb6b372f830fe4aab89460bb4b6147cfd924f (diff) |
Handle case where write result is zero.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6009
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1620,6 +1620,12 @@ 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 (result > 0) { if ((size_t)result == remaining) break; ptr += result; |