Cherrypick "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:
> Cr-Commit-Position: refs/heads/master@{#293894}

Bug: 17384482
Change-Id: I91b55784ec64145882d12119a70acde163ea97e3
(cherry picked from commit d74b8cc5c141fa710fc3f7add32b4a7f068a1b35)

Bug: 17644570
diff --git a/base/ b/base/
index 892592a..9da7aee 100644
--- a/base/
+++ b/base/
@@ -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
 #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