Don't wait in io_binwrite_string
if not necessary. (#9792)
This commit is contained in:
parent
da33c5ac9f
commit
2554c5d3b8
8
io.c
8
io.c
@ -1800,13 +1800,11 @@ io_binwrite_string(VALUE arg)
|
|||||||
// Write as much as possible:
|
// Write as much as possible:
|
||||||
ssize_t result = io_binwrite_string_internal(p->fptr, ptr, remaining);
|
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) {
|
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.
|
||||||
}
|
}
|
||||||
|
else if (result > 0) {
|
||||||
if (result > 0) {
|
|
||||||
if ((size_t)result == remaining) break;
|
if ((size_t)result == remaining) break;
|
||||||
ptr += result;
|
ptr += result;
|
||||||
remaining -= result;
|
remaining -= result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user