summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--io.c7
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 93e1a181ba..33c8665076 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Jun 16 09:11:36 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_close): always call #close method. [ruby-core:23853]
+
+ * io.c (argf_skip): should close only when current_file is available.
+
Thu Jun 11 17:49:33 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/bigdecimal/bigdecimal.c (gfCheckVal): never used.
diff --git a/io.c b/io.c
index dafe0af258..708a676126 100644
--- a/io.c
+++ b/io.c
@@ -4518,10 +4518,7 @@ static void
argf_close(file)
VALUE file;
{
- if (TYPE(file) == T_FILE)
- rb_io_close(file);
- else
- rb_funcall3(file, rb_intern("close"), 0, 0);
+ rb_funcall3(file, rb_intern("close"), 0, 0);
}
static int
@@ -5769,7 +5766,7 @@ argf_binmode()
static VALUE
argf_skip()
{
- if (next_p != -1) {
+ if (init_p && next_p == 0) {
argf_close(current_file);
next_p = 1;
}