diff options
author | Alexey Brodkin <Alexey.Brodkin@synopsys.com> | 2017-03-10 14:44:22 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-03-12 13:42:42 (GMT) |
commit | e15966ac7f3b43df2acf869f98089762807d0568 (patch) | |
tree | 2a7048a279d7f691854a23ff8a4016ab991d60c6 /src | |
parent | bcdf874adb1f1895342c31eac784b8cca96a5a6b (diff) | |
download | libnl-e15966ac7f3b43df2acf869f98089762807d0568.zip libnl-e15966ac7f3b43df2acf869f98089762807d0568.tar.gz libnl-e15966ac7f3b43df2acf869f98089762807d0568.tar.bz2 |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/utils.c b/src/lib/utils.c index 5878f27..feb1d4e 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)); |