mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (fptr_finalize): revert last change. [ruby-dev:38648]
* io.c (fptr_finalize): skip close(2) for fd 0,1,2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e54f880643
commit
d3b852345a
2 changed files with 9 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Jun 16 22:47:37 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (fptr_finalize): revert last change. [ruby-dev:38648]
|
||||
|
||||
* io.c (fptr_finalize): skip close(2) for fd 0,1,2.
|
||||
|
||||
Tue Jun 16 20:07:09 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* transcode.c (transcode_restartable0): refix can't build with VC9.
|
||||
|
|
6
io.c
6
io.c
|
@ -3221,8 +3221,8 @@ fptr_finalize(rb_io_t *fptr, int noraise)
|
|||
if (io_fflush(fptr) < 0 && NIL_P(err))
|
||||
err = noraise ? Qtrue : INT2NUM(errno);
|
||||
}
|
||||
if (noraise && (IS_PREP_STDIO(fptr) || fptr->fd <= 2)) {
|
||||
goto check_err;
|
||||
if (IS_PREP_STDIO(fptr) || fptr->fd <= 2) {
|
||||
goto skip_fd_close;
|
||||
}
|
||||
if (fptr->stdio_file) {
|
||||
/* fptr->stdio_file is deallocated anyway
|
||||
|
@ -3237,11 +3237,11 @@ fptr_finalize(rb_io_t *fptr, int noraise)
|
|||
if (close(fptr->fd) < 0 && NIL_P(err))
|
||||
err = noraise ? Qtrue : INT2NUM(errno);
|
||||
}
|
||||
skip_fd_close:
|
||||
fptr->fd = -1;
|
||||
fptr->stdio_file = 0;
|
||||
fptr->mode &= ~(FMODE_READABLE|FMODE_WRITABLE);
|
||||
|
||||
check_err:
|
||||
if (!NIL_P(err) && !noraise) {
|
||||
switch(TYPE(err)) {
|
||||
case T_FIXNUM:
|
||||
|
|
Loading…
Reference in a new issue