summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-03-20 14:57:59 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-03-20 15:11:40 +0100
commit9ba78fcfa3dec88928df33be26821e3fd5a10727 (patch)
tree200d43d0356f052fe23da463330e43b37138386e /include
parent10d35e96221675fc62299ba0cfdb0d731c9c7531 (diff)
downloadastra-9ba78fcfa3dec88928df33be26821e3fd5a10727.tar.gz
astra-9ba78fcfa3dec88928df33be26821e3fd5a10727.tar.bz2
astra-9ba78fcfa3dec88928df33be26821e3fd5a10727.tar.xz
astra-9ba78fcfa3dec88928df33be26821e3fd5a10727.zip
Use FlushFileBuffers in Windows
Diffstat (limited to 'include')
-rw-r--r--include/astra/clog.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/astra/clog.h b/include/astra/clog.h
index c0cbae4..6ffb660 100644
--- a/include/astra/clog.h
+++ b/include/astra/clog.h
@@ -74,6 +74,8 @@
#ifndef _MSC_VER
#include <unistd.h>
#else
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
#include <io.h>
#define open _open
#define close _close
@@ -634,8 +636,13 @@ _clog_log(const char *sfile, int sline, enum clog_level level,
free(dynbuf);
}
#ifndef _MSC_VER
- // FIXME
fsync(logger->fd);
+#else
+ HANDLE h = (HANDLE) _get_osfhandle(logger->fd);
+ if (h != INVALID_HANDLE_VALUE) {
+ // This call will fail on a console fd, but that's ok.
+ FlushFileBuffers(h);
+ }
#endif
}
}