summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io.c b/io.c
index 79c3024538..474562a944 100644
--- a/io.c
+++ b/io.c
@@ -2157,7 +2157,10 @@ io_read(int argc, VALUE *argv, VALUE io)
rb_scan_args(argc, argv, "02", &length, &str);
if (NIL_P(length)) {
- if (!NIL_P(str)) StringValue(str);
+ if (!NIL_P(str)){
+ StringValue(str);
+ rb_str_modify(str);
+ }
GetOpenFile(io, fptr);
rb_io_check_char_readable(fptr);
return read_all(fptr, remain_size(fptr), str);