io.c (rb_io_check_writable): don't call io_seek if EOF flag is set,

to avoid clearing EOF flag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2003-12-09 05:12:52 +00:00
parent 39e04f4aa0
commit 231f7cb95f
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,8 @@
Tue Dec 9 12:49:22 2003 Tanaka Akira <akr@m17n.org> Tue Dec 9 14:10:48 2003 Tanaka Akira <akr@m17n.org>
* io.c (rb_io_check_readable): Don't clear EOF flag by io_seek. * io.c (rb_io_check_readable): don't call io_seek if EOF flag is set,
to avoid clearing EOF flag.
(rb_io_check_writable): ditto.
Tue Dec 9 02:53:55 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Tue Dec 9 02:53:55 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>

2
io.c
View File

@ -243,7 +243,7 @@ rb_io_check_writable(fptr)
rb_raise(rb_eIOError, "not opened for writing"); rb_raise(rb_eIOError, "not opened for writing");
} }
#if NEED_IO_SEEK_BETWEEN_RW #if NEED_IO_SEEK_BETWEEN_RW
if ((fptr->mode & FMODE_RBUF) && !fptr->f2) { if ((fptr->mode & FMODE_RBUF) && !feof(fptr->f) && !fptr->f2) {
io_seek(fptr, 0, SEEK_CUR); io_seek(fptr, 0, SEEK_CUR);
} }
#endif #endif