Skip to content

Commit ed72caa

Browse files
author
Anders Johnsen
committed
Revert and fix more of the mac change.
BUG= Review URL: https://codereview.chromium.org//1175603003.
1 parent 265a544 commit ed72caa

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

runtime/bin/process_macos.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,10 @@ class ProcessStarter {
452452
}
453453

454454
if (program_environment_ != NULL) {
455-
environ = program_environment_;
455+
// On MacOS you have to do a bit of magic to get to the
456+
// environment strings.
457+
char*** environ = _NSGetEnviron();
458+
*environ = program_environment_;
456459
}
457460

458461
VOID_TEMP_FAILURE_RETRY(
@@ -653,10 +656,7 @@ class ProcessStarter {
653656

654657

655658
void SetChildOsErrorMessage() {
656-
const int kBufferSize = 1024;
657-
char error_message[kBufferSize];
658-
strerror_r(errno, error_message, kBufferSize);
659-
*os_error_message_ = strdup(error_message);
659+
SetOSErrorMessage(errno);
660660
}
661661

662662

@@ -681,10 +681,10 @@ class ProcessStarter {
681681

682682

683683
void SetOSErrorMessage(int child_errno) {
684-
const int kMaxMessageSize = 256;
685-
char* message = static_cast<char*>(calloc(kMaxMessageSize, 0));
686-
strerror_r(child_errno, message, kMaxMessageSize - 1);
687-
*os_error_message_ = message;
684+
const int kBufferSize = 1024;
685+
char error_message[kBufferSize];
686+
strerror_r(child_errno, error_message, kBufferSize);
687+
*os_error_message_ = strdup(error_message);
688688
}
689689

690690

tests/standalone/standalone.status

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ io/directory_fuzz_test: Skip
4242
# This is expected as MacOS by default runs with a very low number
4343
# of allowed open files ('ulimit -n' says something like 256).
4444
io/socket_many_connections_test: Skip
45+
io/platform_executable_test/06: RuntimeError
4546

4647
[ $compiler == none && ($runtime == drt || $runtime == dartium || $runtime == ContentShellOnAndroid) ]
4748
typed_array_test: Fail # Issue 13921

0 commit comments

Comments
 (0)