summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 15:37:51 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 15:37:51 +0000
commitcaf6d853809abfdd9066ef797ffacfbc2e33e9c4 (patch)
treebd1d93f3747e585cb1e55673980c788be437bfab /io.c
parent71e891ff3eb68669ec2e5833c89add38cffdc3d0 (diff)
downloadruby-caf6d853809abfdd9066ef797ffacfbc2e33e9c4.tar.gz
ruby-caf6d853809abfdd9066ef797ffacfbc2e33e9c4.tar.xz
ruby-caf6d853809abfdd9066ef797ffacfbc2e33e9c4.zip
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
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 9 insertions, 1 deletions
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;