summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-27 08:25:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-27 08:25:18 +0000
commit10496cefeb08b60c3b0bd9f4502934fa39e30ee6 (patch)
tree0b61a80ac0be119b213e99c746077c0077e4fcf5 /io.c
parentb0283eed4377fee555ac7703a5d329092d018f04 (diff)
* io.c (io_close): always calls "close" method of the receiver.
[ruby-core:6911] [ruby-core:8112] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/io.c b/io.c
index 450c39e338..87435a3e38 100644
--- a/io.c
+++ b/io.c
@@ -2226,15 +2226,17 @@ rb_io_close_m(VALUE io)
}
static VALUE
-io_close(VALUE io)
+io_call_close(VALUE io)
{
- if (TYPE(io) == T_FILE) {
- rb_io_close(io);
- return Qnil;
- }
return rb_funcall(io, rb_intern("close"), 0, 0);
}
+static VALUE
+io_close(VALUE io)
+{
+ return rb_rescue(io_call_close, io, 0, 0);
+}
+
/*
* call-seq:
* ios.closed? => true or false