From 1d0651367a3b900ebe99356ddcc1fc19fc0800d6 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 24 Nov 2021 10:58:15 +0100 Subject: Fix: libfstream: Correctly handle FlushFileBuffers resturn status The Windows port uses FlushFileBuffers in libfstream for the implmentation of the file flush method. Unlike other winapi functions, this function returns a boolean and not an error code. Previously, the error code path was executed on success, printing a rather confusing error message, that this file already exists. Signed-off-by: David Oberhollenzer --- lib/fstream/win32/ostream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fstream/win32/ostream.c b/lib/fstream/win32/ostream.c index e593f7e..7b5bd3e 100644 --- a/lib/fstream/win32/ostream.c +++ b/lib/fstream/win32/ostream.c @@ -35,7 +35,7 @@ static int w32_append(HANDLE hnd, const char *filename, static int w32_flush(HANDLE hnd, const char *filename) { - if (FlushFileBuffers(hnd) != 0) { + if (!FlushFileBuffers(hnd)) { w32_perror(filename); return -1; } -- cgit v1.2.3