mirror of https://github.com/OpenTTD/OpenTTD
Codefix: do not pass invalid file descriptor to fdatasync
parent
61e8dcfca7
commit
ee45c8ec1d
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue