Skip to content

Commit 49da404

Browse files
authored
HADOOP-19170. Fixes compilation issues on non-Linux systems (#6822)
Contributed by zhengchenyu
1 parent 504754b commit 49da404

File tree

1 file changed

+9
-3
lines changed
  • hadoop-common-project/hadoop-common/src/main/native/src

1 file changed

+9
-3
lines changed

hadoop-common-project/hadoop-common/src/main/native/src/exception.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,16 @@ jthrowable newIOException(JNIEnv* env, const char *fmt, ...)
110110

111111
const char* terror(int errnum)
112112
{
113-
114-
#if defined(__sun) || defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 32)
115113
// MT-Safe under Solaris or glibc >= 2.32 not supporting sys_errlist/sys_nerr
114+
#if defined(__sun)
115+
#define USE_STR_ERROR
116+
#elif defined(__GLIBC_PREREQ)
117+
#if __GLIBC_PREREQ(2, 32)
118+
#define USE_STR_ERROR
119+
#endif
120+
#endif
121+
122+
#if defined(USE_STR_ERROR)
116123
return strerror(errnum);
117124
#else
118125
if ((errnum < 0) || (errnum >= sys_nerr)) {
@@ -121,4 +128,3 @@ const char* terror(int errnum)
121128
return sys_errlist[errnum];
122129
#endif
123130
}
124-

0 commit comments

Comments
 (0)