From e6440c6fa235c6933fc3a55a36752dc53a6098a8 Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Mon, 18 Jul 2011 20:46:16 +0000 Subject: [PATCH] Do a litmus test of using tmpnam to generate safe temporary file names for the tests that open new data files. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135422 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../file.streams/fstreams/fstream.cons/string.pass.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp b/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp index b5786a384..c2872913f 100644 --- a/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp +++ b/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp @@ -19,8 +19,10 @@ int main() { + char temp [L_tmpnam]; + tmpnam(temp); { - std::fstream fs(std::string("test.dat"), + std::fstream fs(std::string(temp), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); double x = 0; @@ -29,9 +31,9 @@ int main() fs >> x; assert(x == 3.25); } - std::remove("test.dat"); + std::remove(temp); { - std::wfstream fs(std::string("test.dat"), + std::wfstream fs(std::string(temp), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); double x = 0; @@ -40,5 +42,5 @@ int main() fs >> x; assert(x == 3.25); } - std::remove("test.dat"); + std::remove(temp); }