3232
3333#include " gtest/gtest-death-test.h"
3434
35+ #include < stdlib.h>
36+
3537#include < functional>
3638#include < memory>
3739#include < sstream>
@@ -115,7 +117,7 @@ GTEST_DEFINE_string_(
115117GTEST_DEFINE_bool_ (
116118 death_test_use_fork,
117119 testing::internal::BoolFromGTestEnv (" death_test_use_fork" , false ),
118- "Instructs to use fork()/_exit () instead of clone() in death tests. "
120+ "Instructs to use fork()/_Exit () instead of clone() in death tests. "
119121 "Ignored and always uses fork() on POSIX systems where clone() is not "
120122 "implemented. Useful when running under valgrind or similar tools if "
121123 "those do not support clone(). Valgrind 3.3.1 will just fail if "
@@ -299,7 +301,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
299301 fputc (kDeathTestInternalError , parent);
300302 fprintf (parent, " %s" , message.c_str ());
301303 fflush (parent);
302- _exit (1 );
304+ _Exit (1 );
303305 } else {
304306 fprintf (stderr, " %s" , message.c_str ());
305307 fflush (stderr);
@@ -511,7 +513,7 @@ std::string DeathTestImpl::GetErrorLogs() { return GetCapturedStderr(); }
511513// Signals that the death test code which should have exited, didn't.
512514// Should be called only in a death test child process.
513515// Writes a status byte to the child's status file descriptor, then
514- // calls _exit (1).
516+ // calls _Exit (1).
515517void DeathTestImpl::Abort (AbortReason reason) {
516518 // The parent process considers the death test to be a failure if
517519 // it finds any data in our pipe. So, here we write a single flag byte
@@ -523,13 +525,13 @@ void DeathTestImpl::Abort(AbortReason reason) {
523525 GTEST_DEATH_TEST_CHECK_SYSCALL_ (posix::Write (write_fd (), &status_ch, 1 ));
524526 // We are leaking the descriptor here because on some platforms (i.e.,
525527 // when built as Windows DLL), destructors of global objects will still
526- // run after calling _exit (). On such systems, write_fd_ will be
528+ // run after calling _Exit (). On such systems, write_fd_ will be
527529 // indirectly closed from the destructor of UnitTestImpl, causing double
528530 // close if it is also closed here. On debug configurations, double close
529531 // may assert. As there are no in-process buffers to flush here, we are
530532 // relying on the OS to close the descriptor after the process terminates
531533 // when the destructors are not run.
532- _exit (1 ); // Exits w/o any normal exit hooks (we were supposed to crash)
534+ _Exit (1 ); // Exits w/o any normal exit hooks (we were supposed to crash)
533535}
534536
535537// Returns an indented copy of stderr output for a death test.
@@ -1333,7 +1335,7 @@ static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
13331335#endif // GTEST_HAS_CLONE
13341336
13351337 if (use_fork && (child_pid = fork ()) == 0 ) {
1336- _exit (ExecDeathTestChildMain (&args));
1338+ _Exit (ExecDeathTestChildMain (&args));
13371339 }
13381340#endif // GTEST_OS_QNX
13391341#ifdef GTEST_OS_LINUX
0 commit comments