]> arthur.barton.de Git - netdata.git/commitdiff
save database on fatal errors
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 17 Jun 2016 17:46:46 +0000 (20:46 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 17 Jun 2016 17:46:46 +0000 (20:46 +0300)
src/apps_plugin.c
src/log.c
src/log.h
src/main.h

index 900cde352da0574ad67cc413e45be65b144b59ec..39d0efc8af2ad2917cf055758178a128f3a0d8d7 100644 (file)
@@ -213,6 +213,13 @@ char *strdup_debug(const char *file, int line, const char *function, const char
 
 #endif /* NETDATA_INTERNAL_CHECKS */
 
+// ----------------------------------------------------------------------------
+
+void netdata_cleanup_and_exit(int ret) {
+       exit(ret);
+}
+
+
 // ----------------------------------------------------------------------------
 // system functions
 // to retrieve settings of the system
index ae10ae917ac8c8f1189d52bfca9d774b8538fa2c..62f07adde5017a29e8c940a9ff74074851fe69d9 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -214,7 +214,7 @@ void fatal_int( const char *file, const char *function, const unsigned long line
                va_end( args );
        }
 
-       exit(1);
+       netdata_cleanup_and_exit(1);
 }
 
 void log_access( const char *fmt, ... )
index f3f504487a7a1f02cb4eeb3f3f04223fa24d290b..2c0f5cd7a1884c96afc520ad2ad4f122294e36a8 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -2,6 +2,8 @@
 #include <stdarg.h>
 #include <time.h>
 
+#include "main.h"
+
 #ifndef NETDATA_LOG_H
 #define NETDATA_LOG_H 1
 
index 701f8ff24a7e11e44e76f60424a4d210ed0d09e9..a41aa0c2bdcb1e01c25f1378ef82fa60a9c2763d 100644 (file)
@@ -30,6 +30,6 @@ extern struct option_def options[];
 
 extern void kill_childs(void);
 extern int killpid(pid_t pid, int signal);
-extern void netdata_cleanup_and_exit(int ret);
+extern void netdata_cleanup_and_exit(int ret) __attribute__ ((noreturn));
 
 #endif /* NETDATA_MAIN_H */