Skip to content

Commit

Permalink
logopenfile: fix minor format string warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
victorjulien committed Apr 27, 2022
1 parent 1e13f72 commit 07d0ae0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util-logopenfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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\"; "
Expand All @@ -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;
}
Expand Down

0 comments on commit 07d0ae0

Please sign in to comment.