From 10496cefeb08b60c3b0bd9f4502934fa39e30ee6 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 27 Jul 2006 08:25:18 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ io.c | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1530646d06..a7ccfd38fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 27 17:01:01 2006 Yukihiro Matsumoto + + * io.c (io_close): always calls "close" method of the receiver. + [ruby-core:6911] [ruby-core:8112] + Thu Jul 27 16:41:15 2006 Yukihiro Matsumoto * ext/openssl/ossl.h: move inclusion point to shut up diff --git a/io.c b/io.c index 450c39e338..87435a3e38 100644 --- a/io.c +++ b/io.c @@ -2225,14 +2225,16 @@ rb_io_close_m(VALUE io) return Qnil; } +static VALUE +io_call_close(VALUE io) +{ + return rb_funcall(io, rb_intern("close"), 0, 0); +} + static VALUE io_close(VALUE io) { - if (TYPE(io) == T_FILE) { - rb_io_close(io); - return Qnil; - } - return rb_funcall(io, rb_intern("close"), 0, 0); + return rb_rescue(io_call_close, io, 0, 0); } /*