$OpenBSD$

Index: libnetdata/log/log.c
--- libnetdata/log/log.c.orig
+++ libnetdata/log/log.c
@@ -607,12 +607,12 @@ int error_log_limit(int reset) {
         if(prevented) {
             char date[LOG_DATE_LENGTH];
             log_date(date, LOG_DATE_LENGTH);
-            fprintf(stderr, "%s: %s LOG FLOOD PROTECTION reset for process '%s' (prevented %lu logs in the last %ld seconds).\n"
+            fprintf(stderr, "%s: %s LOG FLOOD PROTECTION reset for process '%s' (prevented %lu logs in the last %lld seconds).\n"
                     , date
                     , program_name
                     , program_name
                     , prevented
-                    , now - start
+                    , (long long)(now - start)
             );
         }
 
@@ -628,12 +628,12 @@ int error_log_limit(int reset) {
         if(prevented) {
             char date[LOG_DATE_LENGTH];
             log_date(date, LOG_DATE_LENGTH);
-            fprintf(stderr, "%s: %s LOG FLOOD PROTECTION resuming logging from process '%s' (prevented %lu logs in the last %ld seconds).\n"
+            fprintf(stderr, "%s: %s LOG FLOOD PROTECTION resuming logging from process '%s' (prevented %lu logs in the last %lld seconds).\n"
                     , date
                     , program_name
                     , program_name
                     , prevented
-                    , error_log_throttle_period
+                    , (long long)error_log_throttle_period
             );
         }
 
@@ -650,15 +650,15 @@ int error_log_limit(int reset) {
         if(!prevented) {
             char date[LOG_DATE_LENGTH];
             log_date(date, LOG_DATE_LENGTH);
-            fprintf(stderr, "%s: %s LOG FLOOD PROTECTION too many logs (%lu logs in %ld seconds, threshold is set to %lu logs in %ld seconds). Preventing more logs from process '%s' for %ld seconds.\n"
+            fprintf(stderr, "%s: %s LOG FLOOD PROTECTION too many logs (%lu logs in %lld seconds, threshold is set to %lu logs in %lld seconds). Preventing more logs from process '%s' for %lld seconds.\n"
                     , date
                     , program_name
                     , counter
-                    , now - start
+                    , (long long)(now - start)
                     , error_log_errors_per_period
-                    , error_log_throttle_period
+                    , (long long)error_log_throttle_period
                     , program_name
-                    , start + error_log_throttle_period - now);
+                    , (long long)(start + error_log_throttle_period - now));
         }
 
         prevented++;
@@ -757,7 +757,7 @@ static const char *strerror_result_string(const char *
 
 void error_int( const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) {
     // save a copy of errno - just in case this function generates a new error
-    int __errno = errno;
+    int __errno_bak = errno;
 
     va_list args;
 
@@ -781,9 +781,9 @@ void error_int( const char *prefix, const char *file, 
     vfprintf( stderr, fmt, args );
     va_end( args );
 
-    if(__errno) {
+    if(__errno_bak) {
         char buf[1024];
-        fprintf(stderr, " (errno %d, %s)\n", __errno, strerror_result(strerror_r(__errno, buf, 1023), buf));
+        fprintf(stderr, " (errno %d, %s)\n", __errno_bak, strerror_result(strerror_r(__errno_bak, buf, 1023), buf));
         errno = 0;
     }
     else
@@ -794,7 +794,7 @@ void error_int( const char *prefix, const char *file, 
 
 void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) {
     // save a copy of errno - just in case this function generates a new error
-    int __errno = errno;
+    int __errno_bak = errno;
     va_list args;
 
     if(error_log_syslog) {
@@ -820,7 +820,7 @@ void fatal_int( const char *file, const char *function
     log_unlock();
 
     char action_data[70+1];
-	snprintfz(action_data, 70, "%04lu@%-10.10s:%-15.15s/%d", line, file, function, __errno);
+	snprintfz(action_data, 70, "%04lu@%-10.10s:%-15.15s/%d", line, file, function, __errno_bak);
 	char action_result[60+1];
 	snprintfz(action_result, 60, "%s:%s",program_name, strcmp(program_name,"STREAM_RECEIVER")?netdata_thread_tag():"[x]");
 	send_statistics("FATAL", action_result, action_data);
