Fix usage of strerror_r

Only GNU libc has implementation of the GNU variant of strerror_r, so
also for __GLIBC__ to determine which strerror_r implemenation to use.

This fixes build with musl libc, which makes some, but not all, GNU
extensions available with _GNU_SOURCE.
This commit is contained in:
Natanael Copa
2018-12-25 12:11:35 +01:00
committed by Luis Diaz Mas
parent 7457af292d
commit 480430d397
+2 -2
View File
@@ -54,7 +54,7 @@
#include <stdexcept>
#ifdef EXV_HAVE_STRERROR_R
#ifdef _GNU_SOURCE
#if defined(__GLIBC__) && defined(_GNU_SOURCE)
extern char *strerror_r(int errnum, char *buf, size_t n);
#else
extern int strerror_r(int errnum, char *buf, size_t n);
@@ -348,7 +348,7 @@ namespace Exiv2 {
std::ostringstream os;
#ifdef EXV_HAVE_STRERROR_R
const size_t n = 1024;
#ifdef _GNU_SOURCE
#if defined(__GLIBC__) && defined(_GNU_SOURCE)
char *buf = 0;
char buf2[n];
std::memset(buf2, 0x0, n);