summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-16 01:14:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-16 01:14:28 +0000
commitad0f401a1492f58a7b4e3712d1a62a60ade165ab (patch)
treec38743762b7c17e2b164a896bae60cd6e9007aea
parent54ca01012fc654f95988e78fc92e728484708344 (diff)
downloadruby-ad0f401a1492f58a7b4e3712d1a62a60ade165ab.tar.gz
ruby-ad0f401a1492f58a7b4e3712d1a62a60ade165ab.tar.xz
ruby-ad0f401a1492f58a7b4e3712d1a62a60ade165ab.zip
* io.c (fptr_finalize): should close stdin/stdout/stderr when
closed explicitly. [ruby-core:23853] * io.c (argf_skip): should close only when current_file is available. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--io.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f72b4d13..16ac00296 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Jun 16 06:40:31 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (fptr_finalize): should close stdin/stdout/stderr when
+ closed explicitly. [ruby-core:23853]
+
+ * io.c (argf_skip): should close only when current_file is available.
+
Tue Jun 16 01:50:02 2009 Tanaka Akira <akr@fsij.org>
* vm_eval.c (rb_call0): refine exception message for hidden objects.
diff --git a/io.c b/io.c
index 99872dee1..7f3f6909c 100644
--- a/io.c
+++ b/io.c
@@ -3221,7 +3221,7 @@ fptr_finalize(rb_io_t *fptr, int noraise)
if (io_fflush(fptr) < 0 && NIL_P(err))
err = noraise ? Qtrue : INT2NUM(errno);
}
- if (IS_PREP_STDIO(fptr) || fptr->fd <= 2) {
+ if (noraise && (IS_PREP_STDIO(fptr) || fptr->fd <= 2)) {
goto check_err;
}
if (fptr->stdio_file) {
@@ -8473,7 +8473,7 @@ argf_binmode_p(VALUE argf)
static VALUE
argf_skip(VALUE argf)
{
- if (ARGF.next_p != -1) {
+ if (ARGF.init_p && ARGF.next_p == 0) {
argf_close(ARGF.current_file);
ARGF.next_p = 1;
}