blob: 099d795e70053aed838fe0e015e96503afc25898 [file] [log] [blame]
diff --git a/Source/ThirdParty/gtest/src/gtest-death-test.cc b/Source/ThirdParty/gtest/src/gtest-death-test.cc
index 09083551612..ac8660354ca 100644
--- a/Source/ThirdParty/gtest/src/gtest-death-test.cc
+++ b/Source/ThirdParty/gtest/src/gtest-death-test.cc
@@ -1152,20 +1152,6 @@ struct ExecDeathTestArgs {
int close_fd; // File descriptor to close; the read end of a pipe
};
-# if GTEST_OS_MAC
-inline char** GetEnviron() {
- // When Google Test is built as a framework on MacOS X, the environ variable
- // is unavailable. Apple's documentation (man environ) recommends using
- // _NSGetEnviron() instead.
- return *_NSGetEnviron();
-}
-# else
-// Some POSIX platforms expect you to declare environ. extern "C" makes
-// it reside in the global namespace.
-extern "C" char** environ;
-inline char** GetEnviron() { return environ; }
-# endif // GTEST_OS_MAC
-
# if !GTEST_OS_QNX
// The main function for a threadsafe-style death test child process.
// This function is called in a clone()-ed process and thus must avoid
@@ -1191,8 +1177,11 @@ static int ExecDeathTestChildMain(void* child_arg) {
// unsafe. Since execve() doesn't search the PATH, the user must
// invoke the test program via a valid path that contains at least
// one path separator.
- execve(args->argv[0], args->argv, GetEnviron());
- DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
+ // We have replaced execve() with execv() for WebKit to avoid using
+ // environ. It should be safe because execv() is just a simple wrapper
+ // of execve().
+ execv(args->argv[0], args->argv);
+ DeathTestAbort(std::string("execv(") + args->argv[0] + ", ...) in " +
original_dir + " failed: " +
GetLastErrnoDescription());
return EXIT_FAILURE;