summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-31 07:19:24 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-31 07:19:24 +0000
commit67d66b2652a955c8dfcf2377f2842e1c413e0939 (patch)
tree70a5772aee3d1ad1e8915b96923aadb642a6f708 /io.c
parentef2ff2776b8c7b4d73e0820e7821ee41981ee69e (diff)
* io.c (copy_stream_body): don't check to_io because
Zlib::GzipWriter#to_io returns the underlying IO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 ce0c35048b..14807ae1ee 100644
--- a/io.c
+++ b/io.c
@@ -7702,13 +7702,12 @@ copy_stream_body(VALUE arg)
if (stp->src == argf ||
!(TYPE(stp->src) == T_FILE ||
- rb_respond_to(stp->src, rb_intern("to_io")) ||
TYPE(stp->src) == T_STRING ||
rb_respond_to(stp->src, rb_intern("to_path")))) {
src_fd = -1;
}
else {
- src_io = rb_check_convert_type(stp->src, T_FILE, "IO", "to_io");
+ src_io = TYPE(stp->src) == T_FILE ? stp->src : Qnil;
if (NIL_P(src_io)) {
VALUE args[2];
int oflags = O_RDONLY;
@@ -7730,13 +7729,12 @@ copy_stream_body(VALUE arg)
if (stp->dst == argf ||
!(TYPE(stp->dst) == T_FILE ||
- rb_respond_to(stp->dst, rb_intern("to_io")) ||
TYPE(stp->dst) == T_STRING ||
rb_respond_to(stp->dst, rb_intern("to_path")))) {
dst_fd = -1;
}
else {
- dst_io = rb_check_convert_type(stp->dst, T_FILE, "IO", "to_io");
+ dst_io = TYPE(stp->dst) == T_FILE ? stp->dst : Qnil;
if (NIL_P(dst_io)) {
VALUE args[3];
int oflags = O_WRONLY|O_CREAT|O_TRUNC;