Skip to content

Commit

Permalink
Revert execvpe on Mac and fix usage of strerror_r.
Browse files Browse the repository at this point in the history
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1174903002.
  • Loading branch information
Anders Johnsen committed Jun 10, 2015
1 parent bbdc57e commit bd25e64
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions runtime/bin/process_macos.cc
Expand Up @@ -25,6 +25,9 @@
#include "platform/signal_blocker.h"


extern char** environ;


namespace dart {
namespace bin {

Expand Down Expand Up @@ -449,14 +452,12 @@ class ProcessStarter {
}

if (program_environment_ != NULL) {
VOID_TEMP_FAILURE_RETRY(
execvpe(path_, const_cast<char* const*>(program_arguments_),
program_environment_));
} else {
VOID_TEMP_FAILURE_RETRY(
execvp(path_, const_cast<char* const*>(program_arguments_)));
environ = program_environment_;
}

VOID_TEMP_FAILURE_RETRY(
execvp(path_, const_cast<char* const*>(program_arguments_)));

ReportChildError();
}

Expand Down Expand Up @@ -682,14 +683,8 @@ class ProcessStarter {
void SetOSErrorMessage(int child_errno) {
const int kMaxMessageSize = 256;
char* message = static_cast<char*>(calloc(kMaxMessageSize, 0));
char* os_error_message = strerror_r(
child_errno, message, kMaxMessageSize - 1);
if (message == os_error_message) {
*os_error_message_ = message;
} else {
free(message);
*os_error_message_ = strdup(os_error_message);
}
strerror_r(child_errno, message, kMaxMessageSize - 1);
*os_error_message_ = message;
}


Expand Down

0 comments on commit bd25e64

Please sign in to comment.