summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-02 07:29:13 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-02 07:29:13 +0000
commit72385b042df0c69d0d74cf998eaf959f0db9b904 (patch)
treed2e197d536bc66c9b68e83e319ee70850db9f0a4 /io.c
parentd1cc0ebb38a23feb37bb16ff2df3137c3cead069 (diff)
* io.c (io_fwrite): freeze converted str.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/io.c b/io.c
index e7464150d9..ed170cda13 100644
--- a/io.c
+++ b/io.c
@@ -1358,7 +1358,11 @@ io_fwrite(VALUE str, rb_io_t *fptr, int nosync)
}
#endif
str = do_writeconv(str, fptr, &converted);
- if (!converted) str = rb_str_new_frozen(str);
+ if (converted)
+ OBJ_FREEZE(str);
+ else
+ str = rb_str_new_frozen(str);
+
return io_binwrite(str, RSTRING_PTR(str), RSTRING_LEN(str),
fptr, nosync);
}