do a better job with 64-bit files
This commit is contained in:
parent
75a69d3b20
commit
39ef727f46
1 changed files with 11 additions and 7 deletions
|
|
@ -5,6 +5,7 @@ off_t
|
||||||
Bseek(Biobuf *bp, off_t offset, int base)
|
Bseek(Biobuf *bp, off_t offset, int base)
|
||||||
{
|
{
|
||||||
vlong n, d;
|
vlong n, d;
|
||||||
|
int bufsz;
|
||||||
|
|
||||||
switch(bp->state) {
|
switch(bp->state) {
|
||||||
default:
|
default:
|
||||||
|
|
@ -28,6 +29,8 @@ Bseek(Biobuf *bp, off_t offset, int base)
|
||||||
*/
|
*/
|
||||||
if(base == 0) {
|
if(base == 0) {
|
||||||
d = n - Boffset(bp);
|
d = n - Boffset(bp);
|
||||||
|
bufsz = bp->ebuf - bp->gbuf;
|
||||||
|
if(-bufsz <= d && d <= bufsz){
|
||||||
bp->icount += d;
|
bp->icount += d;
|
||||||
if(d >= 0) {
|
if(d >= 0) {
|
||||||
if(bp->icount <= 0)
|
if(bp->icount <= 0)
|
||||||
|
|
@ -37,6 +40,7 @@ Bseek(Biobuf *bp, off_t offset, int base)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reset the buffer
|
* reset the buffer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue