From c1948ec29b8dcdc58d2d92700c325abdeab111a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Draszik?= Date: Thu, 25 Aug 2016 13:15:00 +0100 Subject: lib: switch to using strerror_l() instead of strerror_r() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glibc provides two versions of strerror_r(), which can be chosen between using feature test macros _GNU_SOURCE and _POSIX_C_SOURCE. libnl is built using the former, hence we get the glibc special version, and all code so far has been written for this. Other C libraries like musl on the other hand only try to be posix compliant, and only ever provide the posix version of strerror_r(), which has a different signature. Uses in libnl hence generally cause printf() of an *int* with a *string format* specifier for that reason. Additionally, strerror_r() has been deprecated: http://austingroupbugs.net/view.php?id=655 Switch to using strerror_l() (via our wrapper just introduced). Signed-off-by: André Draszik Reviewed-by: Stephane Ayotte Signed-off-by: Thomas Haller --- lib/fib_lookup/lookup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/fib_lookup') diff --git a/lib/fib_lookup/lookup.c b/lib/fib_lookup/lookup.c index 43b6126f..efc862b6 100644 --- a/lib/fib_lookup/lookup.c +++ b/lib/fib_lookup/lookup.c @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -133,7 +134,7 @@ static void result_dump_line(struct nl_object *obj, struct nl_dump_params *p) nl_rtntype2str(res->fr_type, buf, sizeof(buf))); nl_dump(p, "scope %s error %s (%d)\n", rtnl_scope2str(res->fr_scope, buf, sizeof(buf)), - strerror_r(-res->fr_error, buf, sizeof(buf)), res->fr_error); + nl_strerror_l(-res->fr_error), res->fr_error); } static void result_dump_details(struct nl_object *obj, struct nl_dump_params *p) -- cgit v1.2.3