From b25eebdb394702a87df0c774b1692288e18b5b64 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 30 Sep 2008 17:55:25 +0000 Subject: * io.c (rb_io_extract_modeenc): should honor value of the textmode: and binmode: options. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 774f3e7e1..7985aebd7 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; -- cgit