Module: check_mk
Branch: master
Commit: 21d5241a688985c99cac210889f1be68e46f3b3a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=21d5241a688985…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 30 11:36:01 2017 +0100
store: Explicitly call flush and fsync now before renaming a just written temporary file
Change-Id: I4b7bd262843d0ed9f11b52909074d700c4a559b3
---
lib/store.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/store.py b/lib/store.py
index bb12c59..8edf2ce 100644
--- a/lib/store.py
+++ b/lib/store.py
@@ -166,6 +166,9 @@ def save_file(path, content, mode=0660):
os.chmod(tmp_path, mode)
tmp.write(content)
+ tmp.flush()
+ os.fsync(tmp.fileno())
+
os.rename(tmp_path, path)
except Exception, e: