Haiku does not have fdatasync, but has fsync

https://dev.haiku-os.org/ticket/17378
This commit is contained in:
Anonymous Maarten
2024-09-28 18:08:36 +02:00
committed by Anonymous Maarten
parent 396afa2117
commit b3388d5753
+9 -1
View File
@@ -488,9 +488,17 @@ static bool SDLCALL stdio_flush(void *userdata, SDL_IOStatus *status)
} }
#elif defined(_POSIX_SYNCHRONIZED_IO) // POSIX defines this if fdatasync() exists, so we don't need a CMake test. #elif defined(_POSIX_SYNCHRONIZED_IO) // POSIX defines this if fdatasync() exists, so we don't need a CMake test.
#ifndef SDL_PLATFORM_RISCOS // !!! FIXME: however, RISCOS doesn't have the symbol...maybe we need to link to an extra library or something? #ifndef SDL_PLATFORM_RISCOS // !!! FIXME: however, RISCOS doesn't have the symbol...maybe we need to link to an extra library or something?
if (iodata->regular_file && (fdatasync(fileno(iodata->fp)) == -1)) { if (iodata->regular_file) {
int sync_result;
#ifdef SDL_PLATFORM_HAIKU
sync_result = fsync(fileno(iodata->fp));
#else
sync_result = fdatasync(fileno(iodata->fp));
#endif
if (sync_result == -1) {
return SDL_SetError("Error flushing datastream: %s", strerror(errno)); return SDL_SetError("Error flushing datastream: %s", strerror(errno));
} }
}
#endif #endif
#endif #endif