From dc6ee0e36df772499e5a86ee638f5aae160c1023 Mon Sep 17 00:00:00 2001 From: shiqian Date: Tue, 29 Jul 2008 23:15:28 +0000 Subject: [PATCH] Makes death tests create temporary files in /tmp instead of the current folder. --- src/gtest-port.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gtest-port.cc b/src/gtest-port.cc index 2a4d37a4..efc40ca7 100644 --- a/src/gtest-port.cc +++ b/src/gtest-port.cc @@ -96,7 +96,10 @@ class CapturedStderr { CapturedStderr() { uncaptured_fd_ = dup(STDERR_FILENO); - char name_template[] = "captured_stderr.XXXXXX"; + // There's no guarantee that a test has write access to the + // current directory, so we create the temporary file in the /tmp + // directory instead. + char name_template[] = "/tmp/captured_stderr.XXXXXX"; const int captured_fd = mkstemp(name_template); filename_ = name_template; fflush(NULL);