mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 00:33:01 +00:00
sys_fs: Fix race in file stream API
This commit is contained in:
parent
781c5a76d9
commit
2243e22630
@ -3125,6 +3125,7 @@ error_code sys_fs_lsn_lock(ppu_thread&, u32 fd)
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::lock_guard lock(file->mp->mutex);
|
||||||
file->lock.compare_and_swap(0, 1);
|
file->lock.compare_and_swap(0, 1);
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
@ -3140,7 +3141,14 @@ error_code sys_fs_lsn_unlock(ppu_thread&, u32 fd)
|
|||||||
return CELL_EBADF;
|
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
|
// Unlock unconditionally
|
||||||
|
std::lock_guard lock(file->mp->mutex);
|
||||||
file->lock.compare_and_swap(1, 0);
|
file->lock.compare_and_swap(1, 0);
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user