summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io.c b/io.c
index 637dfeae3..ef4649992 100644
--- a/io.c
+++ b/io.c
@@ -2133,6 +2133,9 @@ rb_io_binmode(io)
OpenFile *fptr;
GetOpenFile(io, fptr);
+ if ((fptr->mode & FMODE_BINMODE) && READ_DATA_BUFFERED(fptr->f)) {
+ rb_raise(rb_eIOError, "buffer already filled with text-mode content");
+ }
#ifdef __human68k__
if (fptr->f)
fmode(fptr->f, _IOBIN);