summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-11 08:02:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-11 08:02:36 +0000
commit756cd2852d8faea5139b01bfd5e596d6f9e35b14 (patch)
tree6bc79647b92e8952521ebcec674b1e9e24fd6bc9 /io.c
parenta82d24aa8237d50a8c7d7178d0535327e7ec645c (diff)
* io.c (extract_binmode): raise error even if binmode and textmode
don't conflict. [Bug #5918] [ruby-core:42199] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io.c b/io.c
index ed8ae96d54..3efc5349b5 100644
--- a/io.c
+++ b/io.c
@@ -5020,6 +5020,8 @@ extract_binmode(VALUE opthash, int *fmode)
if (!NIL_P(v)) {
if (*fmode & FMODE_TEXTMODE)
rb_raise(rb_eArgError, "textmode specified twice");
+ if (*fmode & FMODE_BINMODE)
+ rb_raise(rb_eArgError, "both textmode and binmode specified");
if (RTEST(v))
*fmode |= FMODE_TEXTMODE;
}
@@ -5027,6 +5029,8 @@ extract_binmode(VALUE opthash, int *fmode)
if (!NIL_P(v)) {
if (*fmode & FMODE_BINMODE)
rb_raise(rb_eArgError, "binmode specified twice");
+ if (*fmode & FMODE_TEXTMODE)
+ rb_raise(rb_eArgError, "both textmode and binmode specified");
if (RTEST(v))
*fmode |= FMODE_BINMODE;
}