From 5da6c926d9ae95d8a681772dc774dfc811f20dc6 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 13 Jul 2024 18:23:53 +1000 Subject: [PATCH] GameList: Always open icon cache with r+b on Linux Fixes flock() error on startup. --- src/core/game_list.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index 16f27ca55..e7196c09d 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -1655,9 +1655,15 @@ static constexpr const char MEMCARD_TIMESTAMP_CACHE_SIGNATURE[] = {'M', 'C', 'D' FileSystem::ManagedCFilePtr GameList::OpenMemoryCardTimestampCache(bool for_write) { const std::string filename = Path::Combine(EmuFolders::Cache, "memcard_icons.cache"); - const char* mode = for_write ? "r+b" : "rb"; const FileSystem::FileShareMode share_mode = for_write ? FileSystem::FileShareMode::DenyReadWrite : FileSystem::FileShareMode::DenyWrite; +#ifdef _WIN32 + const char* mode = for_write ? "r+b" : "rb"; +#else + // Always open read/write on Linux, since we need it for flock(). + const char* mode = "r+b"; +#endif + FileSystem::ManagedCFilePtr fp = FileSystem::OpenManagedSharedCFile(filename.c_str(), mode, share_mode, nullptr); if (fp) return fp;