diff --git a/src/store/journal.c b/src/store/journal.c index f7f82aa2..53ea0ad9 100644 --- a/src/store/journal.c +++ b/src/store/journal.c @@ -173,7 +173,11 @@ ray_err_t ray_journal_write_bytes(const ray_ipc_header_t* hdr, #ifndef RAY_OS_WINDOWS if (fsync(fileno(g_journal.fp)) != 0) return RAY_ERR_IO; #else - FlushFileBuffers((HANDLE)_get_osfhandle(_fileno(g_journal.fp))); + /* FlushFileBuffers returns 0 (FALSE) on failure — surface it as an I/O + * error like the fsync path above, so SYNC mode's durability guarantee + * isn't silently dropped on Windows. */ + if (!FlushFileBuffers((HANDLE)_get_osfhandle(_fileno(g_journal.fp)))) + return RAY_ERR_IO; #endif } return RAY_OK;