mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-12 07:26:42 +00:00
Bring seek error back to UT64_MAX in dsc ##io
Otherwise seeks beyond the end of the file will not be detected as failures and this causes the dyldcache bin plugin to load single-slice caches 128 times instead of 1, with obvious performance implications.
This commit is contained in:
parent
1b3ba94036
commit
26683b1097
@ -651,7 +651,7 @@ static int r_io_internal_read(RIODscObject * dsc, ut64 off_global, ut8 *buf, int
|
||||
|
||||
static ut64 r_io_dsc_object_seek(RIO *io, RIODscObject *dsc, ut64 offset, int whence) {
|
||||
if (!dsc || offset == UT64_MAX) {
|
||||
return UT64_MAX - 1;
|
||||
return UT64_MAX;
|
||||
}
|
||||
|
||||
ut64 off_global;
|
||||
@ -667,7 +667,7 @@ static ut64 r_io_dsc_object_seek(RIO *io, RIODscObject *dsc, ut64 offset, int wh
|
||||
off_global = dsc->total_size + offset;
|
||||
break;
|
||||
default:
|
||||
return UT64_MAX - 1;
|
||||
return UT64_MAX;
|
||||
}
|
||||
|
||||
RIODscSlice * slice = r_io_dsc_object_get_slice(dsc, off_global);
|
||||
@ -676,13 +676,13 @@ static ut64 r_io_dsc_object_seek(RIO *io, RIODscObject *dsc, ut64 offset, int wh
|
||||
io->off = dsc->total_size;
|
||||
return io->off;
|
||||
}
|
||||
return UT64_MAX - 1;
|
||||
return UT64_MAX;
|
||||
}
|
||||
|
||||
ut64 off_local = off_global - slice->start;
|
||||
off_local = lseek (slice->fd, off_local, SEEK_SET);
|
||||
if (off_local == UT64_MAX) {
|
||||
return UT64_MAX - 1;
|
||||
return UT64_MAX;
|
||||
}
|
||||
|
||||
io->off = off_local + slice->start;
|
||||
|
Loading…
Reference in New Issue
Block a user