summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-23 12:45:26 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-23 12:45:26 +0000
commit243faf286f072f0c45d353e03effc0a531e5df52 (patch)
tree6b1c80c10ce5aa4ed6977e79252d618bb533f900 /io.c
parent929bdcabf7a292da3e1bedab97926f7d932d2d64 (diff)
merges r30122 from trunk into ruby_1_9_2.
-- * io.c (io_read): duplicate string if shared. [ruby-dev:42719] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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);