@cryptotaxi247 / netdata-1 / commits / 7c8930bbf

Add errno to fatal event for statistics (#5291)

Chris Akritidis committed Jan 29, 2019 at 21:20 UTC 7c8930bbfe2c21b3c95ec68331efae8bdde8ac94
1 file changed +5 -3
libnetdata/log/log.c
+5 -3
@@ -377,6 +377,8 @@ void error_int( const char *prefix, const char *file, const char *function, cons
377 }
378
379 void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) {
380 + // save a copy of errno - just in case this function generates a new error
381 + int __errno = errno;
382 va_list args;
383
384 if(error_log_syslog) {
@@ -401,9 +403,9 @@ void fatal_int( const char *file, const char *function, const unsigned long line
403
404 log_unlock();
405
404 - static char action_data[60];
405 - snprintfz(action_data, 60, "%04lu@%-10.10s:%-15.15s", line, file, function);
406 - static char action_result[60];
406 + char action_data[70+1];
407 + snprintfz(action_data, 70, "%04lu@%-10.10s:%-15.15s/%d", line, file, function, __errno);
408 + char action_result[60+1];
409 snprintfz(action_result, 60, "%s:%s",program_name, netdata_thread_tag());
410 send_statistics("FATAL", action_result, action_data);
411