diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-23 07:10:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-23 07:10:56 +0000 |
commit | e119458f71b56d0768f357367a1e9b5ffd2bb10b (patch) | |
tree | 6efdbbf0c9fb2ddc397568769d80f3f7242e237d /io.c | |
parent | f0b7c08890b343f9bacd59273847aeebb68d0cb2 (diff) | |
download | ruby-e119458f71b56d0768f357367a1e9b5ffd2bb10b.tar.gz |
io.c: read BOM only for reading
* io.c (io_strip_bom): just abandon detecting UTF encoding by BOM
unless opened for reading.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -5970,7 +5970,10 @@ static int io_strip_bom(VALUE io) { VALUE b1, b2, b3, b4; + rb_io_t *fptr; + GetOpenFile(io, fptr); + if (!(fptr->mode & FMODE_READABLE)) return 0; if (NIL_P(b1 = rb_io_getbyte(io))) return 0; switch (b1) { case INT2FIX(0xEF): |