1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (rb_io_init_copy): copy also positions. [ruby-talk:100910]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-05-26 04:15:02 +00:00
parent b216b65ce9
commit 13ebee7a9e
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Wed May 26 13:14:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_init_copy): copy also positions. [ruby-talk:100910]
Wed May 26 00:00:00 2004 why the lucky stiff <why@ruby-lang.org>
* ext/syck/syck.c (syck_new_parser): clear parser on init.

2
io.c
View file

@ -3331,11 +3331,13 @@ rb_io_init_copy(dest, io)
}
fd = ruby_dup(fileno(orig->f));
fptr->f = rb_fdopen(fd, mode);
fseeko(fptr->f, ftello(orig->f), SEEK_SET);
if (orig->f2) {
if (fileno(orig->f) != fileno(orig->f2)) {
fd = ruby_dup(fileno(orig->f2));
}
fptr->f2 = rb_fdopen(fd, "w");
fseeko(fptr->f2, ftello(orig->f2), SEEK_SET);
}
if (fptr->mode & FMODE_BINMODE) {
rb_io_binmode(dest);