aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'main.h')
-rw-r--r--main.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.h b/main.h
index a0258cf2ce..6d8f0ed87c 100644
--- a/main.h
+++ b/main.h
@@ -968,6 +968,14 @@ public:
return error("CBlock::WriteToDisk() : ftell failed");
fileout << *this;
+ // Flush stdio buffers and commit to disk before returning
+ fflush(fileout);
+#ifdef __WXMSW__
+ _commit(_fileno(fileout));
+#else
+ fsync(fileno(fileout));
+#endif
+
return true;
}