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

Unified Diff: runtime/bin/utils_macos.cc

Issue 22634003: Replaced strerror() calls with threadsafe strerror_r() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « runtime/bin/utils_linux.cc ('k') | runtime/platform/thread_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/utils_macos.cc
diff --git a/runtime/bin/utils_macos.cc b/runtime/bin/utils_macos.cc
index 69c738e1890cca0849133e52ee31549dedb549f5..c47feddf830425eec9c97a6cbbe5720b65bd5ce1 100644
--- a/runtime/bin/utils_macos.cc
+++ b/runtime/bin/utils_macos.cc
@@ -19,7 +19,10 @@ namespace bin {
OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) {
set_sub_system(kSystem);
set_code(errno);
- SetMessage(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ SetMessage(error_message);
}
@@ -27,7 +30,10 @@ void OSError::SetCodeAndMessage(SubSystem sub_system, int code) {
set_sub_system(sub_system);
set_code(code);
if (sub_system == kSystem) {
- SetMessage(strerror(code));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(code, error_message, kBufferSize);
+ SetMessage(error_message);
} else if (sub_system == kGetAddressInfo) {
SetMessage(gai_strerror(code));
} else {
« no previous file with comments | « runtime/bin/utils_linux.cc ('k') | runtime/platform/thread_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698