* io.c (io_fwrite): freeze converted str.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
glass 2014-01-02 07:29:13 +00:00
parent d1cc0ebb38
commit 72385b042d
2 changed files with 9 additions and 1 deletions

View File

@ -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

6
io.c
View File

@ -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);
}