]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
include: add `format` attribute to `__ulogd_log` declaration
authorJeremy Sowden <jeremy@azazel.net>
Sun, 21 Nov 2021 20:41:35 +0000 (20:41 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 23 Nov 2021 13:24:53 +0000 (14:24 +0100)
`__ulogd_log` takes a printf-style format string and matching arguments.
Add the gcc `format` attribute to its declaration in order to allow the
compiler to type-check the function arguments against the specifiers in
the format string.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/ulogd/ulogd.h

index 1636a8caa8546175f2bcdb70e53accb4bd0bd6ae..a487c8e70e37cddb56af43374bf3a79477bdba3c 100644 (file)
@@ -299,8 +299,9 @@ void ulogd_register_plugin(struct ulogd_plugin *me);
 /* allocate a new ulogd_key */
 struct ulogd_key *alloc_ret(const uint16_t type, const char*);
 
-/* write a message to the daemons' logfile */
-void __ulogd_log(int level, char *file, int line, const char *message, ...);
+/* write a message to the daemon's logfile */
+void __ulogd_log(int level, char *file, int line, const char *message, ...)
+       __attribute__((format(printf, 4, 5)));
 /* macro for logging including filename and line number */
 #define ulogd_log(level, format, args...) \
        __ulogd_log(level, __FILE__, __LINE__, format, ## args)