diff options
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1686,13 +1686,20 @@ read_all(rb_io_t *fptr, long siz, VALUE str) else rb_str_set_len(str, 0); make_readconv(fptr, 0); while (1) { + int fin, state = 0; + if (fptr->cbuf_len > fptr->cbuf_capa / 2) { io_shift_cbuf(fptr, fptr->cbuf_len, &str); } - if (more_char(fptr) == -1) { + + fin = rb_protect((VALUE (*)(VALUE))more_char, (VALUE)fptr, &state); + if (fin == -1 || state != 0) { if (fptr->cbuf_len) { io_shift_cbuf(fptr, fptr->cbuf_len, &str); } + if (state != 0) { + rb_jump_tag(state); + } clear_readconv(fptr); return io_enc_str(str, fptr); } |