diff --git a/ChangeLog b/ChangeLog index 4ea3f8f64d..3b41bda559 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,11 @@ Tue Sep 30 23:00:05 2008 Yuki Sonoda (Yugui) * lib/test/unit/testcase.rb: ditto. +Tue Sep 30 20:17:26 2008 Yukihiro Matsumoto + + * io.c (rb_io_extract_modeenc): should honor value of the + textmode: and binmode: options. + Tue Sep 30 17:04:59 2008 Yukihiro Matsumoto * test/bigdecimal/test_bigdecimal.rb (test_sqrt_bigdecimal): wrong diff --git a/io.c b/io.c index 774f3e7e18..7985aebd7f 100644 --- a/io.c +++ b/io.c @@ -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;