From caf6d853809abfdd9066ef797ffacfbc2e33e9c4 Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 15 Jan 2009 15:37:51 +0000 Subject: merges r21492 and r21495 from trunk into ruby_1_9_1. * io.c (rb_io_close_read): call rb_io_fptr_cleanup() instead of fptr_finalize() because the fptr has special finalizser if it is a pipe. [ruby-dev:37757] (3) * io.c (io_reopen, rb_io_init_copy): should register fptr to pipe_list when copying pipe fptr. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index 59e5274ba..b4493846b 100644 --- a/io.c +++ b/io.c @@ -3364,7 +3364,7 @@ rb_io_close_read(VALUE io) write_io = GetWriteIO(io); if (io != write_io) { rb_io_t *wfptr; - fptr_finalize(fptr, Qfalse); + rb_io_fptr_cleanup(fptr, Qfalse); GetOpenFile(write_io, wfptr); RFILE(io)->fptr = wfptr; RFILE(write_io)->fptr = NULL; @@ -5224,6 +5224,10 @@ io_reopen(VALUE io, VALUE nfile) if (orig->pathv) fptr->pathv = orig->pathv; else fptr->pathv = Qnil; fptr->finalize = orig->finalize; +#if defined (__CYGWIN__) || !defined(HAVE_FORK) + if (fptr->finalize == pipe_finalize) + pipe_add_fptr(fptr); +#endif fd = fptr->fd; fd2 = orig->fd; @@ -5375,6 +5379,10 @@ rb_io_init_copy(VALUE dest, VALUE io) fptr->lineno = orig->lineno; if (!NIL_P(orig->pathv)) fptr->pathv = orig->pathv; fptr->finalize = orig->finalize; +#if defined (__CYGWIN__) || !defined(HAVE_FORK) + if (fptr->finalize == pipe_finalize) + pipe_add_fptr(fptr); +#endif fd = ruby_dup(orig->fd); fptr->fd = fd; -- cgit