From 792fb220a31a42043de6962fac6a1f6c030d67c5 Mon Sep 17 00:00:00 2001
From: Dimitry Andric <dimitry@andric.com>
Date: Thu, 22 Jun 2023 12:33:58 +0200
Subject: [PATCH] Only use GNU specific strerror_r() API when __GLIBC__ is
 defined. (#791)

---
 src/internal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/internal.c b/src/internal.c
index ef83b712b..a7747b700 100644
--- src/internal.c
+++ src/internal.c
@@ -431,8 +431,8 @@ char *cleanpath(char *path) {
 
 const char *xstrerror(int errnum, char *buf, size_t len) {
 #ifdef HAVE_STRERROR_R
-# ifdef __USE_GNU
-    /* Annoying linux specific API contract */
+# if defined(__USE_GNU) && defined(__GLIBC__)
+    /* Annoying GNU specific API contract */
     return strerror_r(errnum, buf, len);
 # else
     strerror_r(errnum, buf, len);
