summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-10 16:47:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-10 16:47:03 +0000
commit4e6dbec8c84961424d5beb9a9d1fb66912a78957 (patch)
tree08a3a6b9882ff7391b169013e14d650880c941ba /io.c
parent5fd433efbb3481fe13995cb33b27c1b39092e4f1 (diff)
* configure.in (RUBY_CHECK_IO_NEED): added more tests.
* io.c (rb_io_check_readable): seek after synchronized write. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/io.c b/io.c
index 4ac72c9..737776d 100644
--- a/io.c
+++ b/io.c
@@ -213,6 +213,8 @@ flush_before_seek(fptr)
# define SEEK_END 2
#endif
+#define FMODE_SYNCWRITE (FMODE_SYNC|FMODE_WRITABLE)
+
void
rb_io_check_readable(fptr)
OpenFile *fptr;
@@ -221,7 +223,9 @@ rb_io_check_readable(fptr)
rb_raise(rb_eIOError, "not opened for reading");
}
#if NEED_IO_SEEK_BETWEEN_RW
- if ((fptr->mode & FMODE_WBUF) && !fptr->f2) {
+ if (((fptr->mode & FMODE_WBUF) ||
+ (fptr->mode & (FMODE_SYNCWRITE|FMODE_RBUF)) == FMODE_SYNCWRITE) &&
+ !fptr->f2) {
io_seek(fptr, 0, SEEK_CUR);
}
fptr->mode |= FMODE_RBUF;