diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | io.c | 6 |
2 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Thu Jan 2 16:07:21 2014 Masaki Matsushita <glass.saga@gmail.com> + + * io.c (io_fwrite): freeze converted str. + Thu Jan 2 04:15:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> * eval.c (rb_longjmp): remove an extra modifier from the forward @@ -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); } |