libgtk3: remove non-existent configure options
[buildroot-gz.git] / package / libnl / 0004-lib-escape-usage-of-strerror_l-if-it-doesn-t-exist-i.patch
blob6a9c35438619c9eda38dd4fef898761e1569616e
1 From e15966ac7f3b43df2acf869f98089762807d0568 Mon Sep 17 00:00:00 2001
2 From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
3 Date: Fri, 10 Mar 2017 17:44:22 +0300
4 Subject: [PATCH] lib: escape usage of strerror_l() if it doesn't exist in libc
6 uClibc doesn't implement strerror_l() and thus libnl starting from
7 3.2.29 couldn't be compiled with it any longer.
9 To work-around that problem we'll just do a check on strerror_l()
10 availability during configuration and if it's not there just fall back
11 to locale-less strerror().
13 See-also: 6c2d111177e91184073c44f83d4a6182aaba06d7
15 http://lists.infradead.org/pipermail/libnl/2017-March/002301.html
17 Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
18 Signed-off-by: Thomas Haller <thaller@redhat.com>
19 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
20 ---
21 Patch status: upstream commit e15966ac7f3b43df
23 configure.ac | 2 ++
24 lib/utils.c | 8 +++++++-
25 src/lib/utils.c | 6 ++++++
26 3 files changed, 15 insertions(+), 1 deletion(-)
28 diff --git a/configure.ac b/configure.ac
29 index 68b285e5b15c..2739b997ee3a 100644
30 --- a/configure.ac
31 +++ b/configure.ac
32 @@ -121,6 +121,8 @@ fi
34 AC_CONFIG_SUBDIRS([doc])
36 +AC_CHECK_FUNCS([strerror_l])
38 AC_CONFIG_FILES([
39 Makefile
40 libnl-3.0.pc
41 diff --git a/lib/utils.c b/lib/utils.c
42 index fb350d13fd2f..06273c5b291e 100644
43 --- a/lib/utils.c
44 +++ b/lib/utils.c
45 @@ -30,7 +30,9 @@
46 #include <netlink/utils.h>
47 #include <linux/socket.h>
48 #include <stdlib.h> /* exit() */
49 +#ifdef HAVE_STRERROR_L
50 #include <locale.h>
51 +#endif
53 /**
54 * Global variable indicating the desired level of debugging output.
55 @@ -123,9 +125,10 @@ int __nl_read_num_str_file(const char *path, int (*cb)(long, const char *))
57 const char *nl_strerror_l(int err)
59 + const char *buf;
60 +#ifdef HAVE_STRERROR_L
61 int errno_save = errno;
62 locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
63 - const char *buf;
65 if (loc == (locale_t)0) {
66 if (errno == ENOENT)
67 @@ -140,6 +143,9 @@ const char *nl_strerror_l(int err)
70 errno = errno_save;
71 +#else
72 + buf = strerror(err);
73 +#endif
74 return buf;
76 /** @endcond */
77 diff --git a/src/lib/utils.c b/src/lib/utils.c
78 index 5878f279c364..feb1d4ef4056 100644
79 --- a/src/lib/utils.c
80 +++ b/src/lib/utils.c
81 @@ -81,6 +81,7 @@ void nl_cli_fatal(int err, const char *fmt, ...)
82 fprintf(stderr, "\n");
83 } else {
84 char *buf;
85 +#ifdef HAVE_STRERROR_L
86 locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
87 if (loc == (locale_t)0) {
88 if (errno == ENOENT)
89 @@ -91,9 +92,14 @@ void nl_cli_fatal(int err, const char *fmt, ...)
91 if (loc != (locale_t)0)
92 buf = strerror_l(err, loc);
93 +#else
94 + buf = strerror(err);
95 +#endif
96 fprintf(stderr, "%s\n", buf);
97 +#ifdef HAVE_STRERROR_L
98 if (loc != (locale_t)0)
99 freelocale(loc);
100 +#endif
103 exit(abs(err));
105 2.11.0