summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2022-01-11 09:54:37 -0800
committerDavid Ahern <dsahern@kernel.org>2022-01-26 10:19:08 -0700
commitbf71c8f214b786f3180ebb7a6444ca75c75d8bfd (patch)
tree90af49a9a709f81950b59aa0cff4cdf889c45d58 /lib
parent5632cf69ad59b2081123fe7706dbb29e09e8a478 (diff)
downloadiproute2-bf71c8f214b786f3180ebb7a6444ca75c75d8bfd.tar.gz
libbpf: fix clang warning about format non-literal
Add format attribute to the format string in print routines. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David Ahern <dsahern@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bpf_libbpf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c
index 50ef16bd..921716ae 100644
--- a/lib/bpf_libbpf.c
+++ b/lib/bpf_libbpf.c
@@ -23,12 +23,14 @@
#include "bpf_util.h"
-static int verbose_print(enum libbpf_print_level level, const char *format, va_list args)
+static int __attribute__((format(printf, 2, 0)))
+verbose_print(enum libbpf_print_level level, const char *format, va_list args)
{
return vfprintf(stderr, format, args);
}
-static int silent_print(enum libbpf_print_level level, const char *format, va_list args)
+static int __attribute__((format(printf, 2, 0)))
+silent_print(enum libbpf_print_level level, const char *format, va_list args)
{
if (level > LIBBPF_WARN)
return 0;