diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-22 17:33:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-22 17:33:10 +0000 |
commit | 4341c58c399e7f855da23b8d3ee795e0ff3e8397 (patch) | |
tree | 81a5b824aac1973cd25c8711508604da04aedf13 /io.c | |
parent | f56c6318de7332e1a6c930f2ddc8ed93ab55d96a (diff) | |
download | ruby-4341c58c399e7f855da23b8d3ee795e0ff3e8397.tar.gz |
* io.c (rb_io_extract_modeenc): fail only if conflicting
text/binary modes given explicitly. [ruby-dev:45268][Bug #6055]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -4817,7 +4817,7 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash, vmode_handle: if (NIL_P(vmode)) { - fmode = FMODE_READABLE | DEFAULT_TEXTMODE; + fmode = FMODE_READABLE; oflags = O_RDONLY; } else if (!NIL_P(intmode = rb_check_to_integer(vmode, "to_int"))) { @@ -4867,6 +4867,11 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash, if (!has_enc) rb_io_ext_int_to_encs(rb_ascii8bit_encoding(), NULL, &enc, &enc2); } +#if DEFAULT_TEXTMODE + else if (NIL_P(vmode)) { + fmode |= DEFAULT_TEXTMODE; + } +#endif if (!has_vmode) { v = rb_hash_aref(opthash, sym_mode); if (!NIL_P(v)) { |