Skip to content

Commit

Permalink
HADOOP-19170. Fixes compilation issues on non-Linux systems (#6822)
Browse files Browse the repository at this point in the history
Reviewed-by: Steve Loughran <[email protected]>
Reviewed-by: Wei-Chiu Chuang <[email protected]>
  • Loading branch information
zhengchenyu authored May 14, 2024
1 parent c927060 commit 4cb4d5d
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,16 @@ jthrowable newIOException(JNIEnv* env, const char *fmt, ...)

const char* terror(int errnum)
{

#if defined(__sun) || defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 32)
// 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
#endif
#endif

#if defined(USE_STR_ERROR)
return strerror(errnum);
#else
if ((errnum < 0) || (errnum >= sys_nerr)) {
Expand All @@ -121,4 +128,3 @@ const char* terror(int errnum)
return sys_errlist[errnum];
#endif
}

0 comments on commit 4cb4d5d

Please sign in to comment.