Fix character devices support on FreeBSD (f.ex: /dev/da0)

This commit is contained in:
pancake 2015-08-19 20:56:41 +02:00
parent f98542631d
commit dadc293986
2 changed files with 3 additions and 2 deletions

View File

@ -786,7 +786,7 @@ R_API ut64 r_io_size(RIO *io) {
eprintf("Failed to reset the file position\n");
}
io->va = oldva;
if (size == 0 && r_io_is_blockdevice (io)) {
if (r_io_is_blockdevice (io)) {
io->va = 0;
size = UT64_MAX;
}

View File

@ -64,7 +64,8 @@ static int r_io_def_mmap_refresh_def_mmap_buf(RIOMMapFileObj *mmo) {
} else {
cur = 0;
}
if (r_file_size (mmo->filename) > ST32_MAX) {
st64 sz = r_file_size (mmo->filename);
if (sz == 0 || sz > ST32_MAX) {
// Do not use mmap if the file is huge
mmo->rawio = 1;
}