* testsuite/util/testsuite_fs.h (nonexistent_path): Don't use tempnam.

From-SVN: r223450
This commit is contained in:
Jonathan Wakely 2015-05-20 18:28:04 +01:00 committed by Jonathan Wakely
parent 793cac74e9
commit 7769c9deff
2 changed files with 7 additions and 10 deletions

View File

@ -1,5 +1,7 @@
2015-05-20 Jonathan Wakely <jwakely@redhat.com>
* testsuite/util/testsuite_fs.h (nonexistent_path): Don't use tempnam.
PR libstdc++/66078
* include/bits/stl_iterator.h (__make_move_if_noexcept_iterator): Add
overload for pointers.

View File

@ -26,10 +26,8 @@
#include <iostream>
#include <string>
#include <cstdio>
#if defined(_GNU_SOURCE) || _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L
# include <stdlib.h>
# include <unistd.h>
#endif
#include <stdlib.h>
#include <unistd.h>
namespace __gnu_test
{
@ -84,12 +82,9 @@ namespace __gnu_test
::close(fd);
p = tmp;
#else
char* tmp = tempnam(".", "test.");
if (!tmp)
throw std::experimental::filesystem::filesystem_error("tempnam failed",
std::error_code(errno, std::generic_category()));
p = tmp;
::free(tmp);
char buf[64];
std::sprintf(buf, "test.%lu", (unsigned long)::getpid());
p = buf;
#endif
return p;
}