From ee45c8ec1d75e67466cf70e9d732eea8841f9c75 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 9 Mar 2025 18:13:44 +0100 Subject: [PATCH] Codefix: do not pass invalid file descriptor to fdatasync --- src/ini.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ini.cpp b/src/ini.cpp index dc56ffd583..d13cca3cd3 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -82,6 +82,7 @@ bool IniFile::SaveToDisk(const std::string &filename) */ #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 int f = open(file_new.c_str(), O_RDWR); + if (f < 0) return false; int ret = fdatasync(f); close(f); if (ret != 0) return false;