From e93f6c3fc72904c0d178c9cdd57323071ef4ce12 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 20 Oct 2024 21:07:11 +0200 Subject: [PATCH] main: fix format string related warnings for log/debug printf functions Signed-off-by: Felix Fietkau --- main.c | 2 +- netifd.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 4c4b1ff..ac0fcfe 100644 --- a/main.c +++ b/main.c @@ -89,7 +89,7 @@ netifd_delete_process(struct netifd_process *proc) close(proc->log.fd.fd); } -static void +static void __attribute__((format (printf, 1, 0))) netifd_udebug_vprintf(const char *format, va_list ap) { if (!udebug_buf_valid(&udb_log)) diff --git a/netifd.h b/netifd.h index a462abd..0c0537f 100644 --- a/netifd.h +++ b/netifd.h @@ -100,10 +100,12 @@ struct netifd_process { bool log_overflow; }; -void netifd_udebug_printf(const char *format, ...); +void netifd_udebug_printf(const char *format, ...) + __attribute__((format (printf, 1, 2))); void netifd_udebug_config(struct udebug_ubus *ctx, struct blob_attr *data, bool enabled); -void netifd_log_message(int priority, const char *format, ...); +void netifd_log_message(int priority, const char *format, ...) + __attribute__((format (printf, 2, 3))); int netifd_start_process(const char **argv, char **env, struct netifd_process *proc); void netifd_kill_process(struct netifd_process *proc); -- 2.30.2