Project

General

Profile

Bug #2575 » io.c.diff

trial fix for NetBSD and FreeBSD - taca (Takahiro Kambe), 02/05/2010 05:21 PM

View differences:

io.c
r = write(fileno(f), RSTRING(str)->ptr+offset, l);
TRAP_END;
#if BSD_STDIO
fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET);
{
int saved_errno;
off_t pos;
saved_errno = errno;
pos = lseek(fileno(f), (off_t)0, SEEK_CUR);
if (pos != -1)
fseeko(f, pos, SEEK_SET);
errno = saved_errno;
}
#endif
if (r == n) return len;
if (0 <= r) {
......
goto again;
rb_sys_fail(fptr->path);
}
if (fptr->f) /* update pos in FILE structure [ruby-core:21561] */
if (fptr->f) { /* update pos in FILE structure [ruby-core:21561] */
fflush(fptr->f);
#if defined(__SOFF) && defined(__NetBSD__)
fptr->f->_flags &= ~__SOFF;
(void)io_tell(fptr);
#endif
}
}
rb_str_resize(str, n);
(2-2/2)