Author: coppro
Date: Mon Jul 18 15:46:16 2011
New Revision: 135422
URL: http://llvm.org/viewvc/llvm-project?rev=135422&view=rev
Log:
Do a litmus test of using tmpnam to generate safe temporary file names
for the tests that open new data files.
Modified:
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
Modified:
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
URL:
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp?rev=135422&r1=135421&r2=135422&view=diff
==============================================================================
---
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
(original)
+++
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
Mon Jul 18 15:46:16 2011
@@ -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 @@
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 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits