32
32
33
33
#include " gtest/gtest-death-test.h"
34
34
35
+ #include < stdlib.h>
36
+
35
37
#include < functional>
36
38
#include < memory>
37
39
#include < sstream>
@@ -115,7 +117,7 @@ GTEST_DEFINE_string_(
115
117
GTEST_DEFINE_bool_ (
116
118
death_test_use_fork,
117
119
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. "
119
121
"Ignored and always uses fork() on POSIX systems where clone() is not "
120
122
"implemented. Useful when running under valgrind or similar tools if "
121
123
"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 };
299
301
fputc (kDeathTestInternalError , parent);
300
302
fprintf (parent, " %s" , message.c_str ());
301
303
fflush (parent);
302
- _exit (1 );
304
+ _Exit (1 );
303
305
} else {
304
306
fprintf (stderr, " %s" , message.c_str ());
305
307
fflush (stderr);
@@ -511,7 +513,7 @@ std::string DeathTestImpl::GetErrorLogs() { return GetCapturedStderr(); }
511
513
// Signals that the death test code which should have exited, didn't.
512
514
// Should be called only in a death test child process.
513
515
// Writes a status byte to the child's status file descriptor, then
514
- // calls _exit (1).
516
+ // calls _Exit (1).
515
517
void DeathTestImpl::Abort (AbortReason reason) {
516
518
// The parent process considers the death test to be a failure if
517
519
// it finds any data in our pipe. So, here we write a single flag byte
@@ -523,13 +525,13 @@ void DeathTestImpl::Abort(AbortReason reason) {
523
525
GTEST_DEATH_TEST_CHECK_SYSCALL_ (posix::Write (write_fd (), &status_ch, 1 ));
524
526
// We are leaking the descriptor here because on some platforms (i.e.,
525
527
// 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
527
529
// indirectly closed from the destructor of UnitTestImpl, causing double
528
530
// close if it is also closed here. On debug configurations, double close
529
531
// may assert. As there are no in-process buffers to flush here, we are
530
532
// relying on the OS to close the descriptor after the process terminates
531
533
// 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)
533
535
}
534
536
535
537
// 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) {
1333
1335
#endif // GTEST_HAS_CLONE
1334
1336
1335
1337
if (use_fork && (child_pid = fork ()) == 0 ) {
1336
- _exit (ExecDeathTestChildMain (&args));
1338
+ _Exit (ExecDeathTestChildMain (&args));
1337
1339
}
1338
1340
#endif // GTEST_OS_QNX
1339
1341
#ifdef GTEST_OS_LINUX
0 commit comments