From 7769c9deffec3ac3fab8d9a67e8de9e69d2cbd6b Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 20 May 2015 18:28:04 +0100 Subject: [PATCH] * testsuite/util/testsuite_fs.h (nonexistent_path): Don't use tempnam. From-SVN: r223450 --- libstdc++-v3/ChangeLog | 2 ++ libstdc++-v3/testsuite/util/testsuite_fs.h | 15 +++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 50b1626cfb8..ce5573c473b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,7 @@ 2015-05-20 Jonathan Wakely + * 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. diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h index f404a7a7ff8..3873a609a5f 100644 --- a/libstdc++-v3/testsuite/util/testsuite_fs.h +++ b/libstdc++-v3/testsuite/util/testsuite_fs.h @@ -26,10 +26,8 @@ #include #include #include -#if defined(_GNU_SOURCE) || _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L -# include -# include -#endif +#include +#include 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; } -- 2.30.2