diff options
Diffstat (limited to 'src/io.c')
| -rw-r--r-- | src/io.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -630,8 +630,13 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io) if (mrb_nil_p(buf)) { buf = mrb_str_new(mrb, NULL, maxlen); } + + mrb_str_modify(mrb, RSTRING(buf)); + if (RSTRING_LEN(buf) != maxlen) { buf = mrb_str_resize(mrb, buf, maxlen); + } else { + mrb_str_modify(mrb, RSTRING(buf)); } fptr = (struct mrb_io *)io_get_open_fptr(mrb, io); |
