c358dbd0e2
Include upstream equivalent patch to fix build with older kernel headers. This fixes build failures caused by the previous (reverted) version bump: http://autobuild.buildroot.net/results/563/563f46e9a11f9e3b174a4e1308444f284d1b3421/ http://autobuild.buildroot.net/results/970/970463b628d9c81d5e217e92a455d2e05d0aa89e/ http://autobuild.buildroot.net/results/cee/ceea635a9d620398cbcd44ccb859b07bf6682780/ Add libc-compat.h patch to make it work for musl libc. Add another upstream patch to fix both missing strerror_l() implementation, and optionally missing locale support in uClibc-ng: http://autobuild.buildroot.net/results/dce/dce5d21c27df57ac96d9302752dd1802e7a9786b/ http://autobuild.buildroot.net/results/c4b/c4b1c3f396ddd1d9242aed0953558606f929d57d/ http://autobuild.buildroot.net/results/44d/44dd3db6cdda4646fa12ccf243d6aca16bed3c90/ Add host-pkgconf dependency, since configure.ac uses PKG_CHECK_MODULES. Add optional dependency on the 'check' package. Cc: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
107 lines
2.7 KiB
Diff
107 lines
2.7 KiB
Diff
From e15966ac7f3b43df2acf869f98089762807d0568 Mon Sep 17 00:00:00 2001
|
|
From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
|
|
Date: Fri, 10 Mar 2017 17:44:22 +0300
|
|
Subject: [PATCH] lib: escape usage of strerror_l() if it doesn't exist in libc
|
|
|
|
uClibc doesn't implement strerror_l() and thus libnl starting from
|
|
3.2.29 couldn't be compiled with it any longer.
|
|
|
|
To work-around that problem we'll just do a check on strerror_l()
|
|
availability during configuration and if it's not there just fall back
|
|
to locale-less strerror().
|
|
|
|
See-also: 6c2d111177e91184073c44f83d4a6182aaba06d7
|
|
|
|
http://lists.infradead.org/pipermail/libnl/2017-March/002301.html
|
|
|
|
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
|
|
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
|
|
---
|
|
Patch status: upstream commit e15966ac7f3b43df
|
|
|
|
configure.ac | 2 ++
|
|
lib/utils.c | 8 +++++++-
|
|
src/lib/utils.c | 6 ++++++
|
|
3 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 68b285e5b15c..2739b997ee3a 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -121,6 +121,8 @@ fi
|
|
|
|
AC_CONFIG_SUBDIRS([doc])
|
|
|
|
+AC_CHECK_FUNCS([strerror_l])
|
|
+
|
|
AC_CONFIG_FILES([
|
|
Makefile
|
|
libnl-3.0.pc
|
|
diff --git a/lib/utils.c b/lib/utils.c
|
|
index fb350d13fd2f..06273c5b291e 100644
|
|
--- a/lib/utils.c
|
|
+++ b/lib/utils.c
|
|
@@ -30,7 +30,9 @@
|
|
#include <netlink/utils.h>
|
|
#include <linux/socket.h>
|
|
#include <stdlib.h> /* exit() */
|
|
+#ifdef HAVE_STRERROR_L
|
|
#include <locale.h>
|
|
+#endif
|
|
|
|
/**
|
|
* Global variable indicating the desired level of debugging output.
|
|
@@ -123,9 +125,10 @@ int __nl_read_num_str_file(const char *path, int (*cb)(long, const char *))
|
|
|
|
const char *nl_strerror_l(int err)
|
|
{
|
|
+ const char *buf;
|
|
+#ifdef HAVE_STRERROR_L
|
|
int errno_save = errno;
|
|
locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
|
|
- const char *buf;
|
|
|
|
if (loc == (locale_t)0) {
|
|
if (errno == ENOENT)
|
|
@@ -140,6 +143,9 @@ const char *nl_strerror_l(int err)
|
|
}
|
|
|
|
errno = errno_save;
|
|
+#else
|
|
+ buf = strerror(err);
|
|
+#endif
|
|
return buf;
|
|
}
|
|
/** @endcond */
|
|
diff --git a/src/lib/utils.c b/src/lib/utils.c
|
|
index 5878f279c364..feb1d4ef4056 100644
|
|
--- a/src/lib/utils.c
|
|
+++ b/src/lib/utils.c
|
|
@@ -81,6 +81,7 @@ void nl_cli_fatal(int err, const char *fmt, ...)
|
|
fprintf(stderr, "\n");
|
|
} else {
|
|
char *buf;
|
|
+#ifdef HAVE_STRERROR_L
|
|
locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
|
|
if (loc == (locale_t)0) {
|
|
if (errno == ENOENT)
|
|
@@ -91,9 +92,14 @@ void nl_cli_fatal(int err, const char *fmt, ...)
|
|
}
|
|
if (loc != (locale_t)0)
|
|
buf = strerror_l(err, loc);
|
|
+#else
|
|
+ buf = strerror(err);
|
|
+#endif
|
|
fprintf(stderr, "%s\n", buf);
|
|
+#ifdef HAVE_STRERROR_L
|
|
if (loc != (locale_t)0)
|
|
freelocale(loc);
|
|
+#endif
|
|
}
|
|
|
|
exit(abs(err));
|
|
--
|
|
2.11.0
|
|
|