aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-11-24 10:58:15 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-11-24 12:33:57 +0100
commit1d0651367a3b900ebe99356ddcc1fc19fc0800d6 (patch)
treed47ace819ba5142ce7530cc3bb4547eb183b994e
parente5540b5a3a545ed4e3f3df97be131ec81a155032 (diff)
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 <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/fstream/win32/ostream.c2
1 files changed, 1 insertions, 1 deletions
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;
}