@cryptotaxi247 / netdata-1 / commits / 778d403c4

save database on fatal errors

Costa Tsaousis (ktsaou) committed Jun 17, 2016 at 20:46 UTC 778d403c438613bc71b6517709c898f878e32a58
4 files changed +11 -2
src/apps_plugin.c
+7
@@ -213,6 +213,13 @@ char *strdup_debug(const char *file, int line, const char *function, const char
213
214 #endif /* NETDATA_INTERNAL_CHECKS */
215
216 +// ----------------------------------------------------------------------------
217 +
218 +void netdata_cleanup_and_exit(int ret) {
219 + exit(ret);
220 +}
221 +
222 +
223 // ----------------------------------------------------------------------------
224 // system functions
225 // to retrieve settings of the system
src/log.c
+1 -1
@@ -214,7 +214,7 @@ void fatal_int( const char *file, const char *function, const unsigned long line
214 va_end( args );
215 }
216
217 - exit(1);
217 + netdata_cleanup_and_exit(1);
218 }
219
220 void log_access( const char *fmt, ... )
src/log.h
+2
@@ -2,6 +2,8 @@
2 #include <stdarg.h>
3 #include <time.h>
4
5 +#include "main.h"
6 +
7 #ifndef NETDATA_LOG_H
8 #define NETDATA_LOG_H 1
9
src/main.h
+1 -1
@@ -30,6 +30,6 @@ extern struct option_def options[];
30
31 extern void kill_childs(void);
32 extern int killpid(pid_t pid, int signal);
33 -extern void netdata_cleanup_and_exit(int ret);
33 +extern void netdata_cleanup_and_exit(int ret) __attribute__ ((noreturn));
34
35 #endif /* NETDATA_MAIN_H */