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

Unified Diff: runtime/bin/process_macos.cc

Issue 1175603003: Revert and fix more of the mac change. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_macos.cc
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index de7f149cb8f33b9cbaabb196bca4a7f81974912c..6d628086f4a820596764cd4693bfa8e3d5702e49 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -452,7 +452,10 @@ class ProcessStarter {
}
if (program_environment_ != NULL) {
- environ = program_environment_;
+ // On MacOS you have to do a bit of magic to get to the
+ // environment strings.
+ char*** environ = _NSGetEnviron();
+ *environ = program_environment_;
}
VOID_TEMP_FAILURE_RETRY(
@@ -653,10 +656,7 @@ class ProcessStarter {
void SetChildOsErrorMessage() {
- const int kBufferSize = 1024;
- char error_message[kBufferSize];
- strerror_r(errno, error_message, kBufferSize);
- *os_error_message_ = strdup(error_message);
+ SetOSErrorMessage(errno);
}
@@ -681,10 +681,10 @@ class ProcessStarter {
void SetOSErrorMessage(int child_errno) {
- const int kMaxMessageSize = 256;
- char* message = static_cast<char*>(calloc(kMaxMessageSize, 0));
- strerror_r(child_errno, message, kMaxMessageSize - 1);
- *os_error_message_ = message;
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(child_errno, error_message, kBufferSize);
+ *os_error_message_ = strdup(error_message);
}
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698