1
0
Fork 0

Codefix: do not pass invalid file descriptor to fdatasync

pull/13783/head
Rubidium 2025-03-09 18:13:44 +01:00
parent 62a571c892
commit 3006e93094
1 changed files with 1 additions and 0 deletions

View File

@ -82,6 +82,7 @@ bool IniFile::SaveToDisk(const std::string &filename)
*/ */
#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
int f = open(file_new.c_str(), O_RDWR); int f = open(file_new.c_str(), O_RDWR);
if (f < 0) return false;
int ret = fdatasync(f); int ret = fdatasync(f);
close(f); close(f);
if (ret != 0) return false; if (ret != 0) return false;