1
0
Fork 0

Codefix: do not pass invalid file descriptor to fdatasync

pull/13787/head
Rubidium 2025-03-09 18:13:44 +01:00 committed by rubidium42
parent 61e8dcfca7
commit ee45c8ec1d
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
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;