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
2024-09-03 20:43:10 +10:00
parent 1eb1b03141
commit 87eded4bce
5 changed files with 71 additions and 20 deletions

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());