Skip to content

Commit

Permalink
* io.c (io_reopen): keep duplex pipe in correct mode for exception
Browse files Browse the repository at this point in the history
  safeness.  fixed: [ruby-dev:25152]


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Dec 21, 2004
1 parent e618dd0 commit fca667f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
@@ -1,3 +1,8 @@
Tue Dec 21 12:22:40 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>

* io.c (io_reopen): keep duplex pipe in correct mode for exception
safeness. fixed: [ruby-dev:25152]

Tue Dec 21 12:10:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>

* ext/tk/lib/tk/grid.rb: rescue bug of 'grid configure' on Tcl/Tk8.3-
Expand Down Expand Up @@ -43,7 +48,7 @@ Mon Dec 20 23:22:26 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>

Mon Dec 20 22:56:39 2004 Tanaka Akira <akr@m17n.org>

* gc.c (stack_end_address): gcc noinline attribute is available since
* gc.c (stack_end_address): gcc noinline attribute is available since
gcc-3.1.

Mon Dec 20 14:07:02 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Expand Down
14 changes: 12 additions & 2 deletions io.c
Expand Up @@ -3180,11 +3180,21 @@ io_reopen(io, nfile)
rb_sys_fail(orig->path);
}
else {
FILE *f2 = fptr->f2;
fclose(fptr->f);
fptr->f = NULL;
fptr->f = f2;
fptr->f2 = NULL;
fptr->mode &= ~FMODE_READABLE;
if (dup2(fd2, fd) < 0)
rb_sys_fail(orig->path);
fptr->f = rb_fdopen(fd, mode);
if (f2) {
fptr->f = rb_fdopen(fd, "r");
fptr->f2 = f2;
fptr->mode |= FMODE_READABLE;
}
else {
fptr->f = rb_fdopen(fd, mode);
}
}
rb_thread_fd_close(fd);
if ((orig->mode & FMODE_READABLE) && pos >= 0) {
Expand Down

0 comments on commit fca667f

Please sign in to comment.