mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
Win32/File.cpp: Avoid potential race in concurrent writes
Uninitialized data is better than overwritten data. Affects SPU Cache (unprotected writes).
This commit is contained in:
parent
3f7afb8375
commit
66b6bae596
@ -1303,12 +1303,12 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
||||
|
||||
DWORD nwritten = 0;
|
||||
OVERLAPPED ovl{};
|
||||
const u64 pos = m_pos;
|
||||
const u64 pos = m_pos.fetch_add(size);
|
||||
ovl.Offset = DWORD(pos);
|
||||
ovl.OffsetHigh = DWORD(pos >> 32);
|
||||
ensure(WriteFile(m_handle, data, size, &nwritten, &ovl)); // "file::write"
|
||||
ensure(nwritten == size);
|
||||
nwritten_sum += nwritten;
|
||||
m_pos += nwritten;
|
||||
|
||||
if (nwritten < size)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user