aboutgitcodebugslistschat
path: root/pasta.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-10-13 15:50:29 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-11-07 09:54:56 +0100
commit59722031744e76c5619ed5b46b8aae76b01b32ac (patch)
tree31b76a426bd405718b9a0285283174111c711d2f /pasta.c
parent50d46ec847492dbcf6f0b15221188ad439d5e572 (diff)
downloadpasst-59722031744e76c5619ed5b46b8aae76b01b32ac.tar
passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.gz
passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.bz2
passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.lz
passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.xz
passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.zst
passt-59722031744e76c5619ed5b46b8aae76b01b32ac.zip
log: Enable format warnings
logmsg() takes printf like arguments, but because it's not a built in, the compiler won't generate warnings if the format string and parameters don't match. Enable those by using the format attribute. Strictly speaking this is a gcc extension, but I believe it is also supported by some other common compilers. We already use some other attributes in various places. For now, just use it and we can worry about compilers that don't support it if it comes up. This exposes some warnings from existing callers, both in gcc and in clang-tidy: - Some are straight out bugs, which we correct - It's occasionally useful to invoke the logging functions with an empty string, which gcc objects to, so disable that specific warning in the Makefile - Strictly speaking the C standard requires that the parameter for a %p be a (void *), not some other pointer type. That's only likely to cause problems in practice on weird architectures with different sized representations for pointers to different types. Nonetheless add the casts to make it happy. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pasta.c')
-rw-r--r--pasta.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pasta.c b/pasta.c
index 5fd44fe..94807a3 100644
--- a/pasta.c
+++ b/pasta.c
@@ -239,7 +239,7 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
if ((size_t)snprintf(sh_arg0, sizeof(sh_arg0),
"-%s", arg.exe) >= sizeof(sh_arg0))
- die("$SHELL is too long (%u bytes)", strlen(arg.exe));
+ die("$SHELL is too long (%zu bytes)", strlen(arg.exe));
sh_argv[0] = sh_arg0;
arg.argv = sh_argv;