health log rotation should restart
Costa Tsaousis (ktsaou) committed
Oct 16, 2016 at 19:49 UTC
b6985220783c0f4fe2839fc8819576fbffc41a8f
1 file changed
+11
src/health.c
+11
@@ -70,6 +70,17 @@ static inline void health_log_rotate(void) {
70
if(unlink(health.log_filename) == -1 && errno != ENOENT)
71
error("Health: cannot remove old alarms log file '%s'", health.log_filename);
72
73
+ // open it with truncate
74
+ health.log_fp = fopen(health.log_filename, "w");
75
+
76
+ if(health.log_fp)
77
+ fclose(health.log_fp);
78
+ else
79
+ error("Health: cannot truncate health log '%s'", health.log_filename);
80
+
81
+ health.log_fp = NULL;
82
+
83
+ health.log_entries_written = 0;
84
health_alarm_log_open();
85
}
86
}