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

Unified Diff: runtime/platform/utils_linux.h

Issue 1466523002: Landing patch set 7 from https://codereview.chromium.org/1450113003/ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/platform/utils_android.h ('k') | runtime/platform/utils_macos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/utils_linux.h
diff --git a/runtime/platform/utils_linux.h b/runtime/platform/utils_linux.h
index f2af4d15b6f9d2e83644df1bcd8ec27fe942716a..bb9594fbdbd65589cfb29dbe2104bb0a5e3ba63f 100644
--- a/runtime/platform/utils_linux.h
+++ b/runtime/platform/utils_linux.h
@@ -60,6 +60,21 @@ inline uint64_t Utils::HostToLittleEndian64(uint64_t value) {
return htole64(value);
}
+
+inline char* Utils::StrError(int err, char* buffer, size_t bufsize) {
+#if !defined(__GLIBC__) || \
+((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
+ // Use the XSI 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
+}
+
} // namespace dart
#endif // PLATFORM_UTILS_LINUX_H_
« no previous file with comments | « runtime/platform/utils_android.h ('k') | runtime/platform/utils_macos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698