From 480430d3977930b8a1aeeec850f14172db0ae94d Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 25 Dec 2018 12:11:35 +0100 Subject: [PATCH] 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. --- src/futils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/futils.cpp b/src/futils.cpp index a30acd98..00e71172 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -54,7 +54,7 @@ #include #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);