From 1d9d6c59959321fbf5cf3c7fd1b9220b49da85db Mon Sep 17 00:00:00 2001 From: Edward Guy Capriolo Date: Tue, 16 Dec 2025 14:03:30 -0500 Subject: [PATCH] HADOOP-19756 make std_error adopters have less friction with hadoop native --- .../hadoop-common/src/main/native/src/exception.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/exception.c b/hadoop-common-project/hadoop-common/src/main/native/src/exception.c index b4a9b81280392..84c1ce309530a 100644 --- a/hadoop-common-project/hadoop-common/src/main/native/src/exception.c +++ b/hadoop-common-project/hadoop-common/src/main/native/src/exception.c @@ -110,15 +110,18 @@ jthrowable newIOException(JNIEnv* env, const char *fmt, ...) const char* terror(int errnum) { -// MT-Safe under Solaris or glibc >= 2.32 not supporting sys_errlist/sys_nerr -#if defined(__sun) - #define USE_STR_ERROR -#elif defined(__GLIBC_PREREQ) - #if __GLIBC_PREREQ(2, 32) - #define USE_STR_ERROR +/* STD_ERROR is the new standard. Alpine musc does not want to be 'detected' it want to be pure and modern. Thus we detect the old glib and handle. */ +#ifdef __GLIBC__ + #if defined(__GLIBC_PREREQ) + #if __GLIBC_PREREQ(2, 32) + #define USE_STR_ERROR + #endif #endif +#else + #define USE_STR_ERROR #endif + #if defined(USE_STR_ERROR) return strerror(errnum); #else