summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--io.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 23966b9f29..76e8e3325d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jan 1 17:50:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_mode_enc): encoding spec is not allowed in binary mode.
+ [ruby-dev:32913]
+
Tue Jan 1 14:41:56 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/rexml: 1.9 patch from Sam Ruby mentioned in his blog:
diff --git a/io.c b/io.c
index a5a5f93743..18d651ea8f 100644
--- a/io.c
+++ b/io.c
@@ -3192,6 +3192,9 @@ rb_io_mode_enc(rb_io_t *fptr, const char *mode)
{
const char *p = strchr(mode, ':');
if (p) {
+ if (fptr->mode & FMODE_BINMODE) {
+ rb_raise(rb_eArgError, "encoding in binary mode");
+ }
mode_enc(fptr, p+1);
}
}