FileSystem: Fix FD leak with atomic updated file on Linux

Also add the ability to explicitly commit and check for errors.
This commit is contained in:
Stenzek committed 2024-09-03 20:43:10 +10:00
1 parent 1eb1b03141
commit 87eded4bce
5 files changed
+71 -20

No files matched your search

+1 -1
View File
@@ -1002,7 +1002,7 @@ bool GameDatabase::SaveToCache()
const u64 gamedb_ts = Host::GetResourceFileTimestamp("gamedb.yaml", false).value_or(0);
Error error;
FileSystem::AtomicRenamedFile file = FileSystem::CreateAtomicRenamedFile(GetCacheFile(), "wb", &error);
FileSystem::AtomicRenamedFile file = FileSystem::CreateAtomicRenamedFile(GetCacheFile(), &error);
if (!file)
{
ERROR_LOG("Failed to open cache file for writing: {}", error.GetDescription());