mirror of
https://github.com/RPCS3/rpcs3
synced 2024-11-02 11:45:30 +00:00
sys_fs: Fix race in file stream API
This commit is contained in:
parent
781c5a76d9
commit
2243e22630
1 changed files with 8 additions and 0 deletions
|
@ -3125,6 +3125,7 @@ error_code sys_fs_lsn_lock(ppu_thread&, u32 fd)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
std::lock_guard lock(file->mp->mutex);
|
||||
file->lock.compare_and_swap(0, 1);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -3140,7 +3141,14 @@ error_code sys_fs_lsn_unlock(ppu_thread&, u32 fd)
|
|||
return CELL_EBADF;
|
||||
}
|
||||
|
||||
// See sys_fs_lsn_lock
|
||||
if (file->mp == &g_mp_sys_dev_hdd0 || file->mp->flags & lv2_mp_flag::strict_get_block_size)
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
// Unlock unconditionally
|
||||
std::lock_guard lock(file->mp->mutex);
|
||||
file->lock.compare_and_swap(1, 0);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue