From 8b78163335152bab91db64c1fae2e32c03167f2b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 22 Dec 2005 01:02:13 +0000 Subject: [PATCH] state file atomicity svn path=/trunk/boinc/; revision=9116 --- lib/mfile.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mfile.C b/lib/mfile.C index e4bcb36e28..e5768cac49 100644 --- a/lib/mfile.C +++ b/lib/mfile.C @@ -132,11 +132,13 @@ int MFILE::close() { int MFILE::flush() { int n, old_len = len; - n = fwrite(buf, 1, len, f); + n = (int)fwrite(buf, 1, len, f); len = 0; if (n != old_len) return ERR_FWRITE; if (fflush(f)) return ERR_FFLUSH; +#ifndef _WIN32 if (fsync(fileno(f)) < 0) return ERR_FSYNC; +#endif return 0; }