diff options
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -2372,9 +2372,6 @@ io_setstrbuf(VALUE *str, long len) long clen = RSTRING_LEN(s); if (clen >= len) { rb_str_modify(s); - if (clen != len) { - rb_str_set_len(s, len); - } return; } len -= clen; @@ -2902,7 +2899,10 @@ io_read(int argc, VALUE *argv, VALUE io) GetOpenFile(io, fptr); rb_io_check_byte_readable(fptr); - if (len == 0) return str; + if (len == 0) { + io_set_read_length(str, 0); + return str; + } READ_CHECK(fptr); #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32) |