--- io.c.orig 2009-11-25 17:45:13.000000000 +0900 +++ io.c 2010-01-08 12:31:15.000000000 +0900 @@ -1297,8 +1297,15 @@ goto again; rb_sys_fail(fptr->path); } - if (fptr->f) /* update pos in FILE structure [ruby-core:21561] */ + if (fptr->f) { +#ifdef __SOFF + fptr->f->_flags &= ~__SOFF; + (void)io_tell(fptr); +#else + /* update pos in FILE structure [ruby-core:21561] */ fflush(fptr->f); +#endif + } } rb_str_resize(str, n);