* io.c (rb_io_extract_modeenc): should honor value of the

textmode: and binmode: options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-09-30 17:55:25 +00:00
parent d370a79c69
commit 414605560f
2 changed files with 7 additions and 2 deletions

View File

@ -45,6 +45,11 @@ Tue Sep 30 23:00:05 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* lib/test/unit/testcase.rb: ditto.
Tue Sep 30 20:17:26 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_extract_modeenc): should honor value of the
textmode: and binmode: options.
Tue Sep 30 17:04:59 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* test/bigdecimal/test_bigdecimal.rb (test_sqrt_bigdecimal): wrong

4
io.c
View File

@ -3922,10 +3922,10 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
else {
VALUE v;
v = rb_hash_aref(opthash, sym_textmode);
if (!NIL_P(v))
if (!NIL_P(v) && RTEST(v))
fmode |= FMODE_TEXTMODE;
v = rb_hash_aref(opthash, sym_binmode);
if (!NIL_P(v)) {
if (!NIL_P(v) && RTEST(v)) {
fmode |= FMODE_BINMODE;
#ifdef O_BINARY
oflags |= O_BINARY;