mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 11:48:36 +12:00
cellFs: Fix cellFsLseek with negative whence
This commit is contained in:
parent
9d2c9e5d62
commit
872be25ed1
1 changed files with 5 additions and 5 deletions
|
@ -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);
|
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);
|
const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
|
||||||
|
|
||||||
if (!file)
|
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;
|
return CELL_EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (whence + 0u >= 3)
|
||||||
|
{
|
||||||
|
return {CELL_EINVAL, whence};
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(file->mp->mutex);
|
std::lock_guard lock(file->mp->mutex);
|
||||||
|
|
||||||
const u64 result = file->file.seek(offset, static_cast<fs::seek_mode>(whence));
|
const u64 result = file->file.seek(offset, static_cast<fs::seek_mode>(whence));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue