From 2a8db73a10373d858df6ef026811047bfbf4083f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 22 Apr 2026 15:43:08 -0400 Subject: Use snprintf --- src/lib/core/multiprocessing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/core/multiprocessing.c b/src/lib/core/multiprocessing.c index 2995568..69bcc02 100644 --- a/src/lib/core/multiprocessing.c +++ b/src/lib/core/multiprocessing.c @@ -76,7 +76,7 @@ int child(struct MultiProcessingPool *pool, struct MultiProcessingTask *task) { if (globals.enable_task_logging) { const char *log_file_fmt = "task-%zu-%d.log"; const int log_file_len = snprintf(NULL, 0, log_file_fmt, mp_global_task_count, task->parent_pid); - snprintf(task->log_file + strlen(task->log_file), sizeof(task->log_file) - log_file_len, log_file_fmt, mp_global_task_count, task->parent_pid); + snprintf(task->log_file + strlen(task->log_file), sizeof(task->log_file) - strlen(task->log_file) - log_file_len, log_file_fmt, mp_global_task_count, task->parent_pid); } fp_log = freopen(task->log_file, "w+", stdout); if (!fp_log) { -- cgit