summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-28 16:31:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-28 16:31:12 +0000
commit4c97d899576a380680a6f852a6758a495a53503f (patch)
tree600d5c5c91f702b17a5b71b00edb4210e89aa65d /io.c
parent3c5b1c71107b43f45dcc640a5293319bb22ba527 (diff)
* io.c (rb_io_check_writable): restrict io_seek by
READ_DATA_PENDING because io_seek(fptr, 0, SEEK_CUR) is meaningful only if read buffer is not empty. call io_seek regardless of NEED_IO_SEEK_BETWEEN_RW. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/io.c b/io.c
index a24faf9..cc1b583 100644
--- a/io.c
+++ b/io.c
@@ -251,11 +251,10 @@ rb_io_check_writable(fptr)
if (!(fptr->mode & FMODE_WRITABLE)) {
rb_raise(rb_eIOError, "not opened for writing");
}
-#if NEED_IO_SEEK_BETWEEN_RW
- if ((fptr->mode & FMODE_RBUF) && !feof(fptr->f) && !fptr->f2) {
+ if ((fptr->mode & FMODE_RBUF) && !feof(fptr->f) && !fptr->f2 &&
+ READ_DATA_PENDING(fptr->f)) {
io_seek(fptr, 0, SEEK_CUR);
}
-#endif
if (!fptr->f2) {
fptr->mode &= ~FMODE_RBUF;
}