From 3fc7dce74ce56691191f19eb941b52ede9391449 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 9 Jun 2023 00:37:42 +0100 Subject: [PATCH] Only register with DLT if DLT logging is enabled. --- ChangeLog.txt | 1 + src/logging.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 579944dc..24f79e5d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -20,6 +20,7 @@ Broker: if the owner/group is not the same as the user/group the broker is running as. In future versions the broker will refuse to open these files. - mosquitto_memcmp_const is now more constant time. +- Only register with DLT if DLT logging is enabled. Client library: - Use CLOCK_BOOTTIME when available, to keep track of time. This solves the diff --git a/src/logging.c b/src/logging.c index 162a6762..a7e62443 100644 --- a/src/logging.c +++ b/src/logging.c @@ -134,10 +134,12 @@ int log__init(struct mosquitto__config *config) setlinebuf(stdout); } #ifdef WITH_DLT - dlt_fifo_check(); - if(dlt_allowed){ - DLT_REGISTER_APP("MQTT","mosquitto log"); - dlt_register_context(&dltContext, "MQTT", "mosquitto DLT context"); + if(log_destinations & MQTT3_LOG_DLT){ + dlt_fifo_check(); + if(dlt_allowed){ + DLT_REGISTER_APP("MQTT","mosquitto log"); + dlt_register_context(&dltContext, "MQTT", "mosquitto DLT context"); + } } #endif return rc;