]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
logging: call exit() in LOG_Message()
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 10 Oct 2019 13:07:10 +0000 (15:07 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 10 Oct 2019 16:05:00 +0000 (18:05 +0200)
Call exit() in LOG_Message() after printing a fatal message to allow the
LOG macro or LOG_Message() to be used directly instead of the LOG_FATAL
macro.

logging.c
sys_timex.c

index b6a0489b32dabc8e403c0aedbf006f05843e90b5..e12bad7f1b6bd094f0f2f2ca7f0ee817a2b2a9cf 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -169,6 +169,7 @@ void LOG_Message(LOG_Severity severity,
         system_log = 0;
         log_message(1, severity, buf);
       }
+      exit(1);
       break;
     default:
       assert(0);
index e54ad248dbf3da9fdd929e66af00e15fc1713c70..0a6b4387685f7564d6dfd706bf8029816f0319c5 100644 (file)
@@ -256,10 +256,8 @@ SYS_Timex_Adjust(struct timex *txc, int ignore_error)
   state = NTP_ADJTIME(txc);
 
   if (state < 0) {
-    if (!ignore_error)
-      LOG_FATAL(NTP_ADJTIME_NAME"(0x%x) failed : %s", txc->modes, strerror(errno));
-    else
-      DEBUG_LOG(NTP_ADJTIME_NAME"(0x%x) failed : %s", txc->modes, strerror(errno));
+    LOG(ignore_error ? LOGS_DEBUG : LOGS_FATAL,
+        NTP_ADJTIME_NAME"(0x%x) failed : %s", txc->modes, strerror(errno));
   }
 
   return state;