Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: runtime/vm/os_thread_linux.cc

Issue 1406253005: Build fixes for fnl/musl (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/virtual_memory_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread_linux.cc
diff --git a/runtime/vm/os_thread_linux.cc b/runtime/vm/os_thread_linux.cc
index 4955cb46aa73576b6715d02aeedc7d310f9c3857..c3fb0f7239b60f01643dc8fc123857e4e1cd2e03 100644
--- a/runtime/vm/os_thread_linux.cc
+++ b/runtime/vm/os_thread_linux.cc
@@ -16,12 +16,24 @@
namespace dart {
+static char* strerror_helper(int err, char* buffer, size_t bufsize) {
+#if !defined(__GLIBC__) || \
+ ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
+ // Use the standard version
+ return strerror_r(err, buffer, bufsize) == 0 ?
+ buffer : const_cast<char*>("strerror_r failed");
+#else
+ // Use the gnu specific version
+ return strerror_r(err, buffer, bufsize);
+#endif
+}
+
#define VALIDATE_PTHREAD_RESULT(result) \
if (result != 0) { \
const int kBufferSize = 1024; \
char error_buf[kBufferSize]; \
FATAL2("pthread error: %d (%s)", result, \
- strerror_r(result, error_buf, kBufferSize)); \
+ strerror_helper(result, error_buf, kBufferSize)); \
}
@@ -40,7 +52,7 @@ namespace dart {
char error_buf[kBufferSize]; \
fprintf(stderr, "%s:%d: pthread error: %d (%s)\n", \
__FILE__, __LINE__, result, \
- strerror_r(result, error_buf, kBufferSize)); \
+ strerror_helper(result, error_buf, kBufferSize)); \
return result; \
}
#else
« no previous file with comments | « no previous file | runtime/vm/virtual_memory_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698