From 07d0ae04d34cdf029729b474fb22598f154fcea6 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 27 Apr 2022 11:39:27 +0200 Subject: [PATCH] logopenfile: fix minor format string warning cppcheck: src/util-logopenfile.c:743:13: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] snprintf(threaded_name, len, "%s.%d.%s", tname, unique_id, ext); ^ src/util-logopenfile.c:752:9: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] snprintf(threaded_name, len, "%s.%d", original_name, unique_id); ^ Bug: #5291. --- src/util-logopenfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index 84c1bc2cc8..1150166d93 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -740,7 +740,7 @@ static bool LogFileThreadedName( tname[dotpos] = '\0'; char *ext = tname + dotpos + 1; if (strlen(tname) && strlen(ext)) { - snprintf(threaded_name, len, "%s.%d.%s", tname, unique_id, ext); + snprintf(threaded_name, len, "%s.%u.%s", tname, unique_id, ext); } else { FatalError(SC_ERR_FATAL, "Invalid filename for threaded mode \"%s\"; " @@ -749,7 +749,7 @@ static bool LogFileThreadedName( } SCFree(tname); } else { - snprintf(threaded_name, len, "%s.%d", original_name, unique_id); + snprintf(threaded_name, len, "%s.%u", original_name, unique_id); } return true; } -- 2.47.2