Add an Android version check for GNU strerror_r. Summary: Android didn't gain GNU's strerror_r until Marshmallow. If we're building libc++ against something older (we build the NDK library against the oldest release we support, currently Gingerbread), fall back to the POSIX version. Reviewers: mclow.lists, EricWF Subscribers: tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D21402 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272827 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/system_error.cpp b/src/system_error.cpp index 885afd1..87f35ae 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp
@@ -21,6 +21,10 @@ #include "string" #include "string.h" +#if defined(__ANDROID__) +#include <android/api-level.h> +#endif + _LIBCPP_BEGIN_NAMESPACE_STD // class error_category @@ -58,7 +62,8 @@ string do_strerror_r(int ev); -#if defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC) +#if defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC) \ + && (!defined(__ANDROID__) || __ANDROID_API__ >= 23) // GNU Extended version string do_strerror_r(int ev) { char buffer[strerror_buff_size];