summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index ba6b695..14203f0 100644
--- a/io.c
+++ b/io.c
@@ -2227,11 +2227,11 @@ rb_io_clone(io)
}
fd = ruby_dup(fileno(orig->f));
fptr->f = rb_fdopen(fd, mode);
- if (fptr->f2) {
+ if (orig->f2) {
if (fileno(orig->f) != fileno(orig->f2)) {
fd = ruby_dup(fileno(orig->f2));
}
- fptr->f = rb_fdopen(fd, "w");
+ fptr->f2 = rb_fdopen(fd, "w");
}
if (fptr->mode & FMODE_BINMODE) {
rb_io_binmode(clone);