Merge pull request #8957 from JosJuice/android-strerror-r

Add Android check for strerror_r variant
This commit is contained in:
LC 2020-07-16 14:19:05 -04:00 committed by GitHub
commit d987cf1dde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -29,7 +29,8 @@ std::string LastStrerrorString()
// We check defines in order to figure out variant is in use, and we store the returned value // We check defines in order to figure out variant is in use, and we store the returned value
// to a variable so that we'll get a compile-time check that our assumption was correct. // to a variable so that we'll get a compile-time check that our assumption was correct.
#if defined(__GLIBC__) && (_GNU_SOURCE || (_POSIX_C_SOURCE < 200112L && _XOPEN_SOURCE < 600)) #if (defined(__GLIBC__) || __ANDROID_API__ >= 23) && \
(_GNU_SOURCE || (_POSIX_C_SOURCE < 200112L && _XOPEN_SOURCE < 600))
const char* str = strerror_r(errno, error_message, BUFFER_SIZE); const char* str = strerror_r(errno, error_message, BUFFER_SIZE);
return std::string(str); return std::string(str);
#else #else