Index: runtime/platform/utils.h |
diff --git a/runtime/platform/utils.h b/runtime/platform/utils.h |
index 54ebf4dd410638cda6854a2d27106648e78fd5fe..faa4ec9e5dad980c4e259f2d7bfe61cfda8b1598 100644 |
--- a/runtime/platform/utils.h |
+++ b/runtime/platform/utils.h |
@@ -214,6 +214,22 @@ class Utils { |
return true; |
#endif |
} |
+ |
+#if !defined(TARGET_OS_WINDOWS) |
Ivan Posva
2015/11/18 05:00:49
A better way to solve this would be to move the im
|
+ static char* StrError(int err, char* buffer, size_t bufsize) { |
+#if !defined(__GLIBC__) || \ |
+ ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) |
+ // Use the standard version |
+ if (strerror_r(err, buffer, bufsize) != 0) { |
+ snprintf(buffer, bufsize, "%s", "strerror_r failed"); |
+ } |
+ return buffer; |
+#else |
+ // Use the gnu specific version |
+ return strerror_r(err, buffer, bufsize); |
+#endif |
+ } |
+#endif |
}; |
} // namespace dart |