| Index: base/safe_strerror_posix.cc
|
| ===================================================================
|
| --- base/safe_strerror_posix.cc (revision 65551)
|
| +++ base/safe_strerror_posix.cc (working copy)
|
| @@ -2,13 +2,16 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "build/build_config.h"
|
| #include "base/safe_strerror_posix.h"
|
|
|
| #include <errno.h>
|
| #include <stdio.h>
|
| #include <string.h>
|
|
|
| -#if defined(__GLIBC__) && defined(__GNUC__)
|
| +#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
|
| // that we meant for them to be potentially unused, which is exactly what this
|
| // attribute is for.
|
| @@ -17,7 +20,7 @@
|
| #define POSSIBLY_UNUSED
|
| #endif
|
|
|
| -#if defined(__GLIBC__)
|
| +#if USE_HISTORICAL_STRERRO_R
|
| // glibc has two strerror_r functions: a historical GNU-specific one that
|
| // returns type char *, and a POSIX.1-2001 compliant one available since 2.3.4
|
| // that returns int. This wraps the GNU-specific one.
|
| @@ -37,7 +40,7 @@
|
| // The GNU version never fails. Unknown errors get an "unknown error" message.
|
| // The result is always null terminated.
|
| }
|
| -#endif // __GLIBC__
|
| +#endif // USE_HISTORICAL_STRERRO_R
|
|
|
| // Wrapper for strerror_r functions that implement the POSIX interface. POSIX
|
| // does not define the behaviour for some of the edge cases, so we wrap it to
|
|
|