io.c.diff

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

Download (996 Bytes)

io.c
488 488
	r = write(fileno(f), RSTRING(str)->ptr+offset, l);
489 489
        TRAP_END;
490 490
#if BSD_STDIO
491
	fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET);
491
	{
492
	    int saved_errno;
493
	    off_t pos;
494

  
495
	    saved_errno = errno;
496
	    pos = lseek(fileno(f), (off_t)0, SEEK_CUR);
497
	    if (pos != -1)
498
		fseeko(f, pos, SEEK_SET);
499
	    errno = saved_errno;
500
	}
492 501
#endif
493 502
        if (r == n) return len;
494 503
        if (0 <= r) {
......
1297 1306
                goto again;
1298 1307
            rb_sys_fail(fptr->path);
1299 1308
        }
1300
        if (fptr->f) /* update pos in FILE structure [ruby-core:21561] */
1309
        if (fptr->f) { /* update pos in FILE structure [ruby-core:21561] */
1301 1310
            fflush(fptr->f);
1311
#if defined(__SOFF) && defined(__NetBSD__)
1312
	    fptr->f->_flags &= ~__SOFF;
1313
	    (void)io_tell(fptr);
1314
#endif
1315
	}
1302 1316
    }
1303 1317
    rb_str_resize(str, n);
1304 1318