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( |