summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 18:00:35 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 18:00:35 +0000
commita8505bfa7d8ed444267db1f738b5fe1ea7de786c (patch)
tree85f649be1e39d1982aea85d3d789c90b47267dad /base
parent58d0dcc23d3d908d2d61f0dbbf4bef3de7da706b (diff)
downloadchromium_src-a8505bfa7d8ed444267db1f738b5fe1ea7de786c.zip
chromium_src-a8505bfa7d8ed444267db1f738b5fe1ea7de786c.tar.gz
chromium_src-a8505bfa7d8ed444267db1f738b5fe1ea7de786c.tar.bz2
NaCl base bringup.
Native client uses the GLIBC style of strerror_r but does not define __GLIBC__. It's possible the right thing to do is for the native client toolchain to define GLIBC, but the path of least resistance seems to be to adjust our conditionals in this file to understand NaCl. Original patch by Eric Seidel. Review URL: http://codereview.chromium.org/4883001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65961 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/safe_strerror_posix.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/base/safe_strerror_posix.cc b/base/safe_strerror_posix.cc
index 68b2fca..a91bb8d 100644
--- a/base/safe_strerror_posix.cc
+++ b/base/safe_strerror_posix.cc
@@ -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 @@ static void POSSIBLY_UNUSED wrap_posix_strerror_r(
// 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