]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
runmodes: minor format string fixes
authorVictor Julien <vjulien@oisf.net>
Tue, 26 Apr 2022 18:17:27 +0000 (20:17 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 3 May 2022 11:30:19 +0000 (13:30 +0200)
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)

src/runmode-erf-file.c
src/runmode-pcap-file.c
src/util-runmodes.c

index 27ef207606d1c30f752788dbbcc5dd8928e2a22d..b4999baabda5c1e1f2c520a087dca5ca4d3b8de7 100644 (file)
@@ -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);
 
index 371fef8dd9a085849226d688c1e2ff48c40d579c..1961b1d80910957d2f0324b5029d4531855468fc 100644 (file)
@@ -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);
index c002395df0440dc7d15ffc730677b7783ddc098c..610d1bb230c6fb4aa54af5944762561912ac8ddb 100644 (file)
@@ -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);