aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-07 13:38:36 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-07 13:38:36 +0000
commit9865ee2c46b7cc9244c3d78b786ee14a7a302e53 (patch)
tree2ffe5f34b4cff56f36e07b7d9ce63234f203542b
parent11ef87461a79877796786af7f0c1eee75ab4f0bf (diff)
downloadruby-9865ee2c46b7cc9244c3d78b786ee14a7a302e53.tar.gz
* io.c (io_read): duplicate string if shared. [ruby-dev:42719]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dc7718fe3a..89962d2dea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Dec 7 22:37:15 2010 Masaya Tarui <tarui@ruby-lnag.org>
+
+ * io.c (io_read): duplicate string if shared. [ruby-dev:42719]
+
Tue Dec 7 22:31:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (OptionParser::Officious): separate completion
diff --git a/io.c b/io.c
index 26af3ce6ef..d5d1220294 100644
--- a/io.c
+++ b/io.c
@@ -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);