diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-16 01:14:28 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-16 01:14:28 +0000 |
commit | 6f1edacc010c48c5762598fed74ff4f1e62d1b20 (patch) | |
tree | c38743762b7c17e2b164a896bae60cd6e9007aea /io.c | |
parent | 7a71dff0bf2a8b701ae05acced62c99fed46c233 (diff) |
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@23699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |