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

Unified Diff: runtime/bin/process_android.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/file_macos.cc ('k') | runtime/bin/process_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_android.cc
diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc
index 49df0c5f31ea67d5a80c0a70abe13df1a341a9a1..30a488b2432d786604f74345f3fa2cb94a5629bf 100644
--- a/runtime/bin/process_android.cc
+++ b/runtime/bin/process_android.cc
@@ -267,7 +267,10 @@ dart::Monitor* ExitCodeHandler::thread_terminate_monitor_ = new dart::Monitor();
static void SetChildOsErrorMessage(char** os_error_message) {
- *os_error_message = strdup(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ *os_error_message = strdup(error_message);
}
@@ -290,7 +293,9 @@ static void ReportChildError(int exec_control_fd) {
// In the case of failure in the child process write the errno and
// the OS error message to the exec control pipe and exit.
int child_errno = errno;
- char* os_error_message = strerror(errno);
+ const int kBufferSize = 1024;
+ char os_error_message[kBufferSize];
+ strerror_r(errno, os_error_message, kBufferSize);
ASSERT(sizeof(child_errno) == sizeof(errno));
int bytes_written =
FDUtils::WriteToBlocking(
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/process_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698