summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortorne <torne@chromium.org>2014-09-09 01:14:19 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-09 08:16:25 +0000
commitc35ed07fdef5741deb5a306ca838a80515399487 (patch)
tree116e4262bbb8599825525b708caa5a33a139cb51
parent0f1683a8611c7677dc0cf6a797d4bb108e6f113f (diff)
downloadchromium_src-c35ed07fdef5741deb5a306ca838a80515399487.zip
chromium_src-c35ed07fdef5741deb5a306ca838a80515399487.tar.gz
chromium_src-c35ed07fdef5741deb5a306ca838a80515399487.tar.bz2
Handle bionic's strerror_r in an ABI-compatible way.
The previous fix in r291050 fixed source compatibility but broke ABI compatibility with older versions of bionic instead. Since older versions of bionic only provide the POSIX version of strerror_r we should instead make sure we always use that version. BUG= Review URL: https://codereview.chromium.org/552753002 Cr-Commit-Position: refs/heads/master@{#293894}
-rw-r--r--base/safe_strerror_posix.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/base/safe_strerror_posix.cc b/base/safe_strerror_posix.cc
index 892592a..9da7aee 100644
--- a/base/safe_strerror_posix.cc
+++ b/base/safe_strerror_posix.cc
@@ -2,6 +2,14 @@
// 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 "build/build_config.h"
#include "base/safe_strerror_posix.h"
@@ -9,8 +17,7 @@
#include <stdio.h>
#include <string.h>
-#define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(__BIONIC__) || \
- defined(OS_NACL))
+#define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(OS_NACL))
#if USE_HISTORICAL_STRERRO_R && defined(__GNUC__)
// GCC will complain about the unused second wrap function unless we tell it