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

Unified Diff: runtime/bin/process_linux.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/process_android.cc ('k') | runtime/bin/process_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_linux.cc
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index 7d974252e63dc34366281f842d6a9ed05c884172..6102e704e6c4ed4cfc06ebd7de754a1d70542e21 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -269,7 +269,9 @@ 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_buf[kBufferSize];
+ *os_error_message = strdup(strerror_r(errno, error_buf, kBufferSize));
}
@@ -292,7 +294,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 error_buf[kBufferSize];
+ char* os_error_message = strerror_r(errno, error_buf, kBufferSize);
ASSERT(sizeof(child_errno) == sizeof(errno));
int bytes_written =
FDUtils::WriteToBlocking(
« no previous file with comments | « runtime/bin/process_android.cc ('k') | runtime/bin/process_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698