Commit c35ed07f authored by torne's avatar torne Committed by Commit bot

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}
parent 0f1683a8
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 "build/build_config.h"
#include "base/safe_strerror_posix.h" #include "base/safe_strerror_posix.h"
...@@ -9,8 +17,7 @@ ...@@ -9,8 +17,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(__BIONIC__) || \ #define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(OS_NACL))
defined(OS_NACL))
#if USE_HISTORICAL_STRERRO_R && defined(__GNUC__) #if USE_HISTORICAL_STRERRO_R && defined(__GNUC__)
// GCC will complain about the unused second wrap function unless we tell it // GCC will complain about the unused second wrap function unless we tell it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment