From 0c23437108bc5c7c00104345f2a22bd9da607e20 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 12 May 2026 12:02:38 -0400 Subject: Placate FORTIFY_SOURCE warning * The log_root in almost every circumstance will be able to handle the extra slash chracter. It complains because log_file and log_path are both sizeof PATH_MAX --- src/lib/core/multiprocessing.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/core/multiprocessing.c b/src/lib/core/multiprocessing.c index 11add1e..b17bdc1 100644 --- a/src/lib/core/multiprocessing.c +++ b/src/lib/core/multiprocessing.c @@ -196,7 +196,9 @@ struct MultiProcessingTask *mp_pool_task(struct MultiProcessingPool *pool, const // Set log file path memset(slot->log_file, 0, sizeof(*slot->log_file)); if (globals.enable_task_logging) { - snprintf(slot->log_file, sizeof(slot->log_file) - strlen(slot->log_file), "%s/", pool->log_root); + snprintf(slot->log_file, sizeof(slot->log_file), "%s", pool->log_root); + // FORTIFY_SOURCE won't leave snprintf alone. The chance for truncation is slim anyway. + strncat(slot->log_file, "/", sizeof(slot->log_file) - strlen(slot->log_file)); } else { snprintf(slot->log_file, sizeof(slot->log_file), "/dev/stdout"); } -- cgit