Index: runtime/bin/process_macos.cc |
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc |
index 33351814675c46b4420a8d29cb4925f166f07f43..c87523c39194ab4e7b47d3dd611fc86934769d19 100644 |
--- a/runtime/bin/process_macos.cc |
+++ b/runtime/bin/process_macos.cc |
@@ -268,7 +268,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); |
} |
@@ -291,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 os_error_message[kBufferSize]; |
+ strerror_r(errno, os_error_message, kBufferSize); |
ASSERT(sizeof(child_errno) == sizeof(errno)); |
int bytes_written = |
FDUtils::WriteToBlocking( |