summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongik Cha <jeongik@google.com>2021-03-11 11:17:40 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-03-11 11:17:40 +0000
commit17cff36c59a954a32655c8febb78446fa8f4026c (patch)
treee29a0c8dd2695fbc6b9f442e16617185103f390a
parentb4952f2ce0f5fa695499c7aed87547c4ffaffa33 (diff)
parent2731d8635ff0dfccb821c102598f8f808657d252 (diff)
downloadlibchrome-17cff36c59a954a32655c8febb78446fa8f4026c.tar.gz
Supplement the condition for strerror_r in bionic am: 231f0e8d02 am: 7833c2d816 am: b75040039c am: 2731d8635f
Original change: https://android-review.googlesource.com/c/platform/external/libchrome/+/1624464 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ida0cbc0a2f89b88d005e2c1bcf9c2a93f55084ac
-rw-r--r--base/posix/safe_strerror.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/base/posix/safe_strerror.cc b/base/posix/safe_strerror.cc
index aef5742d33..aab8b87921 100644
--- a/base/posix/safe_strerror.cc
+++ b/base/posix/safe_strerror.cc
@@ -2,14 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#if defined(__ANDROID__)
-// Post-L versions of bionic define the GNU-specific strerror_r if _GNU_SOURCE
-// is defined, but the symbol is renamed to __gnu_strerror_r which only exists
-// on those later versions. To preserve ABI compatibility with older versions,
-// undefine _GNU_SOURCE and use the POSIX version.
-#undef _GNU_SOURCE
-#endif
-
#include "base/posix/safe_strerror.h"
#include <errno.h>
@@ -22,6 +14,11 @@ namespace base {
#if defined(__GLIBC__) || defined(OS_NACL)
#define USE_HISTORICAL_STRERRO_R 1
+// Post-L versions of bionic define the GNU-specific strerror_r if _GNU_SOURCE
+// is defined, but the symbol is renamed to __gnu_strerror_r which only exists
+// on those later versions. For parity, add the same condition as bionic.
+#elif defined(__BIONIC__) && defined(_GNU_SOURCE) && __ANDROID_API__ >= 23
+#define USE_HISTORICAL_STRERRO_R 1
#else
#define USE_HISTORICAL_STRERRO_R 0
#endif