From f44d8fad50c966b5743d6d4d8fe907c842f8e823 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 31 Aug 2022 10:00:05 +0100 Subject: [PATCH] Fix Coverity 1491742 and 1491741 --- src/logging.c | 2 +- src/sys_tree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/logging.c b/src/logging.c index 6795d7e9..5f22df71 100644 --- a/src/logging.c +++ b/src/logging.c @@ -291,7 +291,7 @@ static int log__vprintf(unsigned int priority, const char *fmt, va_list va) log_line_pos = (size_t)snprintf(log_line, sizeof(log_line), "Time error"); } }else{ - log_line_pos = (size_t)snprintf(log_line, sizeof(log_line), "%d", (int)db.now_real_s); + log_line_pos = (size_t)snprintf(log_line, sizeof(log_line), "%" PRIu64, (uint64_t)db.now_real_s); } if(log_line_pos < sizeof(log_line)-3){ log_line[log_line_pos] = ':'; diff --git a/src/sys_tree.c b/src/sys_tree.c index 419d425f..5350fa56 100644 --- a/src/sys_tree.c +++ b/src/sys_tree.c @@ -217,7 +217,7 @@ void sys_tree__update(int interval, time_t start_time) if(interval && db.now_s - interval > last_update){ uptime = db.now_s - start_time; - len = (uint32_t)snprintf(buf, BUFLEN, "%d seconds", (int)uptime); + len = (uint32_t)snprintf(buf, BUFLEN, "%" PRIu64 " seconds", (uint64_t)uptime); db__messages_easy_queue(NULL, "$SYS/broker/uptime", SYS_TREE_QOS, len, buf, 1, 0, NULL); sys_tree__update_clients(buf);