Fix netty_unix_errors.c compilation on MacOS (#10469)

Motivation:
 The feature test macros did not work as expected on MacOS, so we ended up compiling for the GNU
 variant which resulted in compilation errors.
Modification:
 Add `__APPLE__` as another indicator to use the XSI variant of `strerror_r`.
Result:
 The project now once again compiles on MacOS.
This commit is contained in:
Chris Vest 2020-08-11 14:00:08 +02:00 committed by GitHub
parent 8007f907dd
commit f58223982c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ static jmethodID closedChannelExceptionMethodId = NULL;
Note: `strerrbuf` must be initialized to all zeros prior to calling this function. Note: `strerrbuf` must be initialized to all zeros prior to calling this function.
XSI or GNU functions do not have such a requirement, but our wrappers do. XSI or GNU functions do not have such a requirement, but our wrappers do.
*/ */
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE #if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || __APPLE__) && ! _GNU_SOURCE
static inline int strerror_r_xsi(int errnum, char *strerrbuf, size_t buflen) { static inline int strerror_r_xsi(int errnum, char *strerrbuf, size_t buflen) {
return strerror_r(errnum, strerrbuf, buflen); return strerror_r(errnum, strerrbuf, buflen);
} }