summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/io.c b/io.c
index 533542b297..2e4c335aae 100644
--- a/io.c
+++ b/io.c
@@ -12092,9 +12092,8 @@ rb_io_s_copy_stream(int argc, VALUE *argv, VALUE io)
static VALUE
rb_io_external_encoding(VALUE io)
{
- rb_io_t *fptr;
+ rb_io_t *fptr = RFILE(rb_io_taint_check(io))->fptr;
- GetOpenFile(io, fptr);
if (fptr->encs.enc2) {
return rb_enc_from_encoding(fptr->encs.enc2);
}
@@ -12117,9 +12116,8 @@ rb_io_external_encoding(VALUE io)
static VALUE
rb_io_internal_encoding(VALUE io)
{
- rb_io_t *fptr;
+ rb_io_t *fptr = RFILE(rb_io_taint_check(io))->fptr;
- GetOpenFile(io, fptr);
if (!fptr->encs.enc2) return Qnil;
return rb_enc_from_encoding(io_read_encoding(fptr));
}