From 78ccbc710cf2bca207addebcd4eb4c9152c9ff69 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 4 Jan 2025 12:50:29 +1000 Subject: [PATCH] Cheats: Fix error while exporting --- src/core/cheats.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/cheats.cpp b/src/core/cheats.cpp index 772d2b140..db32702c3 100644 --- a/src/core/cheats.cpp +++ b/src/core/cheats.cpp @@ -1520,7 +1520,7 @@ bool Cheats::ExportCodesToFile(std::string path, const CodeInfoList& codes, Erro for (const CodeInfo& code : codes) { const std::string code_body = FormatCodeForFile(code); - if (std::fwrite(code_body.data(), code_body.length(), 1, fp.get()) != 1 || std::fputc('\n', fp.get()) != 0) + if (std::fwrite(code_body.data(), code_body.length(), 1, fp.get()) != 1 || std::fputc('\n', fp.get()) == EOF) { Error::SetErrno(error, "fwrite() failed: ", errno); FileSystem::DiscardAtomicRenamedFile(fp);