Make sure configuration is saved to storage device
Bug: 20891664
Change-Id: I9bec042155f13bec678944466082a9969e559851
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/utils/os_win32.c b/src/utils/os_win32.c
index 296ea13..890abf4 100644
--- a/src/utils/os_win32.c
+++ b/src/utils/os_win32.c
@@ -216,6 +216,24 @@
}
+int os_fsync(FILE *stream)
+{
+ HANDLE hFile;
+
+ if (stream == NULL)
+ return -1;
+
+ hFile = _get_osfhandle(_fileno(stream));
+ if (hFile == INVALID_HANDLE_VALUE)
+ return -1;
+
+ if (!FlushFileBuffers(hFile))
+ return -1;
+
+ return 0;
+}
+
+
void * os_zalloc(size_t size)
{
return calloc(1, size);