From: Victor Julien Date: Tue, 26 Apr 2022 18:17:27 +0000 (+0200) Subject: runmodes: minor format string fixes X-Git-Tag: suricata-6.0.6~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a4870b6f6c0735ef2f9a3f8d6f292ab51c853e5;p=thirdparty%2Fsuricata.git runmodes: minor format string fixes cppcheck: src/util-runmodes.c:210:9: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); ^ src/util-runmodes.c:211:9: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(qname, sizeof(qname), "pickup%u", thread+1); ^ src/util-runmodes.c:455:9: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); ^ src/util-runmodes.c:457:9: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(qname, sizeof(qname), "pickup%u", thread+1); ^ src/runmode-erf-file.c:188:9: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); ^ src/runmode-erf-file.c:189:9: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(qname, sizeof(qname), "pickup%u", thread+1); ^ src/runmode-pcap-file.c:201:9: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); ^ src/runmode-pcap-file.c:202:9: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint] snprintf(qname, sizeof(qname), "pickup%u", thread+1); ^ Bug: #5291. (cherry picked from commit 2965d809a44817223d3e6bc81e55c2286da5212b) --- diff --git a/src/runmode-erf-file.c b/src/runmode-erf-file.c index 27ef207606..b4999baabd 100644 --- a/src/runmode-erf-file.c +++ b/src/runmode-erf-file.c @@ -185,8 +185,8 @@ int RunModeErfFileAutoFp(void) } for (thread = 0; thread < (uint16_t)thread_max; thread++) { - snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); - snprintf(qname, sizeof(qname), "pickup%u", thread+1); + snprintf(tname, sizeof(tname), "%s#%02d", thread_name_workers, thread + 1); + snprintf(qname, sizeof(qname), "pickup%d", thread + 1); SCLogDebug("tname %s, qname %s", tname, qname); diff --git a/src/runmode-pcap-file.c b/src/runmode-pcap-file.c index 371fef8dd9..1961b1d809 100644 --- a/src/runmode-pcap-file.c +++ b/src/runmode-pcap-file.c @@ -198,8 +198,8 @@ int RunModeFilePcapAutoFp(void) } for (thread = 0; thread < (uint16_t)thread_max; thread++) { - snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); - snprintf(qname, sizeof(qname), "pickup%u", thread+1); + snprintf(tname, sizeof(tname), "%s#%02d", thread_name_workers, thread + 1); + snprintf(qname, sizeof(qname), "pickup%d", thread + 1); SCLogDebug("tname %s, qname %s", tname, qname); SCLogDebug("Assigning %s affinity to cpu %u", tname, cpu); diff --git a/src/util-runmodes.c b/src/util-runmodes.c index c002395df0..610d1bb230 100644 --- a/src/util-runmodes.c +++ b/src/util-runmodes.c @@ -208,8 +208,8 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser, } for (int thread = 0; thread < thread_max; thread++) { - snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); - snprintf(qname, sizeof(qname), "pickup%u", thread+1); + snprintf(tname, sizeof(tname), "%s#%02d", thread_name_workers, thread + 1); + snprintf(qname, sizeof(qname), "pickup%d", thread + 1); SCLogDebug("tname %s, qname %s", tname, qname); @@ -453,9 +453,9 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser, } for (int thread = 0; thread < thread_max; thread++) { - snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1); + snprintf(tname, sizeof(tname), "%s#%02d", thread_name_workers, thread + 1); char qname[TM_QUEUE_NAME_MAX]; - snprintf(qname, sizeof(qname), "pickup%u", thread+1); + snprintf(qname, sizeof(qname), "pickup%d", thread + 1); SCLogDebug("tname %s, qname %s", tname, qname);