Skip to content

Commit

Permalink
tests: use ATTRIBUTE_FORMAT for static functions, too
Browse files Browse the repository at this point in the history
* tests/keyctl.c (append_str): Add ATTRIBUTE_FORMAT.
(kckdfp_to_str): Fix -Wformat warning.
  • Loading branch information
ldv-alt committed Feb 8, 2022
1 parent fbd6b4c commit 83a18e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/keyctl.c
Expand Up @@ -180,7 +180,7 @@ do_keyctl(kernel_ulong_t cmd, const char *cmd_str, ...)
printf(") = %s\n", errstr);
}

static int
static int ATTRIBUTE_FORMAT((__printf__, 3, 4))
append_str(char **buf, size_t *left, const char *fmt, ...)
{
int ret;
Expand Down Expand Up @@ -214,7 +214,7 @@ kckdfp_to_str(struct keyctl_kdf_params *kdf, bool deref_hash, bool deref_oi,
} else if (!kdf->hashname) {
append_str(&pos, &left, "NULL");
} else if (deref_hash) {
append_str(&pos, &left, "\"%.*s\"", limit, kdf->hashname);
append_str(&pos, &left, "\"%.*s\"", (int) limit, kdf->hashname);

if (strnlen(kdf->hashname, limit + 1) > limit)
append_str(&pos, &left, "...");
Expand All @@ -229,7 +229,7 @@ kckdfp_to_str(struct keyctl_kdf_params *kdf, bool deref_hash, bool deref_oi,
} else if (!kdf->otherinfo) {
append_str(&pos, &left, "NULL");
} else if (deref_oi) {
append_str(&pos, &left, "\"%.*s\"", limit, kdf->otherinfo);
append_str(&pos, &left, "\"%.*s\"", (int) limit, kdf->otherinfo);

if (strnlen(kdf->otherinfo, limit + 1) > limit)
append_str(&pos, &left, "...");
Expand Down

0 comments on commit 83a18e2

Please sign in to comment.