diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | io.c | 5 |
2 files changed, 8 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Tue Dec 7 22:37:15 2010 Masaya Tarui <[email protected]> + + * io.c (io_read): duplicate string if shared. [ruby-dev:42719] + Tue Dec 7 22:31:08 2010 Nobuyoshi Nakada <[email protected]> * lib/optparse.rb (OptionParser::Officious): separate completion @@ -2212,7 +2212,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); |