From: Victor Julien Date: Wed, 27 Apr 2022 09:39:27 +0000 (+0200) Subject: logopenfile: fix minor format string warning X-Git-Tag: suricata-7.0.0-beta1~676 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7322%2Fhead;p=thirdparty%2Fsuricata.git 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. --- 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; }