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

Unified Diff: runtime/platform/utils.h

Issue 1450113003: Avoid strerror_r portability issues (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Don't compile for windows Created 5 years, 1 month 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 | « runtime/bin/utils_macos.cc ('k') | runtime/vm/os_thread_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « runtime/bin/utils_macos.cc ('k') | runtime/vm/os_thread_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698