Module: check_mk
Branch: master
Commit: b6c1ba80bb0943dce14af9d1393eb15085629082
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b6c1ba80bb0943…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Nov 29 14:58:16 2016 +0100
4097 FIX Event console: Make writing of status file more robust
Previously, a system crash at an inopportune moment could cause
the status file to be corrupt, requiring manual deletion to start
the mkeventd.
---
.werks/4097 | 12 ++++++++++++
ChangeLog | 3 +++
bin/mkeventd | 7 ++++++-
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.werks/4097 b/.werks/4097
new file mode 100644
index 0000000..c83bc0d
--- /dev/null
+++ b/.werks/4097
@@ -0,0 +1,12 @@
+Title: Event console: Make writing of status file more robust
+Level: 1
+Component: ec
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i3
+Date: 1480427713
+
+Previously, a system crash at an inopportune moment could cause
+the status file to be corrupt, requiring manual deletion to start
+the mkeventd.
diff --git a/ChangeLog b/ChangeLog
index 8bd2313..f80e2b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,9 @@
BI:
* 3991 FIX: BI Aggregations: no longer show duplicate aggregations when an
aggregation has mulitple groups
+ Event Console:
+ * 4097 FIX: Event console: Make writing of status file more robust...
+
Livestatus:
* 3651 FIX: Fixed potential segfault with Nagios core when accessing log/commands
table via Livestatus....
diff --git a/bin/mkeventd b/bin/mkeventd
index d6e8c67..5fb2cfa 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -3458,7 +3458,12 @@ class EventStatus():
status = self.pack_status()
path = g_state_dir + "/status"
# Belive it or not: cPickle is more than two times slower than repr()
- file(path + ".new", "w").write(repr(status) +
"\n")
+ f=file(path + ".new", "w")
+ f.write(repr(status) + "\n")
+ fd = f.fileno()
+ f.flush()
+ f.close()
+ os.fsync(fd)
os.rename(path + ".new", path)
elapsed = time.time() - now
if opt_debug: