aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtest-port.cc
diff options
context:
space:
mode:
authorshiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>2008-07-29 23:15:28 +0000
committershiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>2008-07-29 23:15:28 +0000
commitdc6ee0e36df772499e5a86ee638f5aae160c1023 (patch)
tree52edfdc9f39063ed126c0c6a817c41c4a92dce63 /src/gtest-port.cc
parentd88da49d028d8d01c1e49761be577ed1cc1f5c1d (diff)
downloadgoogletest-dc6ee0e36df772499e5a86ee638f5aae160c1023.tar.gz
googletest-dc6ee0e36df772499e5a86ee638f5aae160c1023.tar.bz2
googletest-dc6ee0e36df772499e5a86ee638f5aae160c1023.zip
Makes death tests create temporary files in /tmp instead of the current folder.
Diffstat (limited to 'src/gtest-port.cc')
-rw-r--r--src/gtest-port.cc5
1 files changed, 4 insertions, 1 deletions
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);