summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-28 02:40:32 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-28 02:40:32 +0000
commit1d0ddd4218e701d086b3e4f21fd38183fa3a4e8a (patch)
treea655e91a72fb779713472f6dff67516b288f21d2 /io.c
parent51ea3db6d565f7048d2953479e90625226f75740 (diff)
merge revision(s) 34753:
* 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/branches/ruby_1_9_3@35826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/io.c b/io.c
index 1aa58d5be7..c664450311 100644
--- a/io.c
+++ b/io.c
@@ -4700,7 +4700,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"))) {
@@ -4747,6 +4747,11 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
if (fmode & FMODE_BINMODE)
oflags |= O_BINARY;
#endif
+#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)) {