1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Fix abuse of fs::pending_file

Debug dumps don't fall into category which needs atomic rewrite.
This commit is contained in:
Nekotekina 2022-01-24 01:18:07 +03:00
parent 065ee621b8
commit 14951d8713
2 changed files with 8 additions and 8 deletions

View File

@ -859,9 +859,9 @@ static void ppu_check_patch_spu_images(const ppu_segment& seg)
if (g_cfg.core.spu_debug)
{
fs::pending_file temp(fs::get_cache_dir() + "/spu_progs/" + vfs::escape(name.substr(name.find_last_of('/') + 1)) + '_' + hash.substr(4) + ".elf");
fs::file temp(fs::get_cache_dir() + "/spu_progs/" + vfs::escape(name.substr(name.find_last_of('/') + 1)) + '_' + hash.substr(4) + ".elf", fs::rewrite);
if (!temp.file || !(temp.file.write(obj.save()), temp.commit()))
if (!temp || !temp.write(obj.save()))
{
ppu_loader.error("Failed to dump SPU program from PPU executable: name='%s', hash=%s", name, hash);
}

View File

@ -4889,19 +4889,19 @@ bool spu_thread::capture_local_storage() const
}
}
fs::pending_file temp(elf_path);
fs::file temp(elf_path, fs::rewrite);
if (!temp.file)
if (!temp)
{
spu_log.error("Failed to create temporary file for '%s' (error=%s)", elf_path, fs::g_tls_error);
spu_log.error("Failed to create file '%s' (error=%s)", elf_path, fs::g_tls_error);
return false;
}
temp.file.write(spu_exec.save());
auto data = spu_exec.save();
if (!temp.commit(false))
if (temp.write(data.data(), data.size()) != data.size())
{
spu_log.error("Failed to create rename temporary file to '%s' (error=%s)", elf_path, fs::g_tls_error);
spu_log.error("Failed to write file '%s' (error=%s)", elf_path, fs::g_tls_error);
return false;
}