cellFs: Fix cellFsLseek with negative whence

This commit is contained in:
Eladash 2020-01-03 22:32:17 +02:00 committed by Ivan
parent 9d2c9e5d62
commit 872be25ed1

View file

@ -1327,11 +1327,6 @@ error_code sys_fs_lseek(ppu_thread& ppu, u32 fd, s64 offset, s32 whence, vm::ptr
sys_fs.trace("sys_fs_lseek(fd=%d, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos);
if (whence >= 3)
{
return {CELL_EINVAL, whence};
}
const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
if (!file)
@ -1339,6 +1334,11 @@ error_code sys_fs_lseek(ppu_thread& ppu, u32 fd, s64 offset, s32 whence, vm::ptr
return CELL_EBADF;
}
if (whence + 0u >= 3)
{
return {CELL_EINVAL, whence};
}
std::lock_guard lock(file->mp->mutex);
const u64 result = file->file.seek(offset, static_cast<fs::seek_mode>(whence));