From 43222a5ec8d80b39a3731194c2e960be50dde221 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 2 Oct 2015 20:38:27 +0100 Subject: [PATCH] testsuite_fs.h (nonexistent_path): Use less generic name for paths. * testsuite/util/testsuite_fs.h (nonexistent_path): Use less generic name for paths. Prefer snprintf to sprintf. From-SVN: r228416 --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/testsuite/util/testsuite_fs.h | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 239cd4467de..287768e4132 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2015-10-02 Jonathan Wakely + * testsuite/util/testsuite_fs.h (nonexistent_path): Use less generic + name for paths. Prefer snprintf to sprintf. + PR libstdc++/67747 * src/filesystem/dir.cc (native_readdir): Remove. (_Dir::advance): Use readdir instead of native_readdir. diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h index 524972ece9b..44aef115ff3 100644 --- a/libstdc++-v3/testsuite/util/testsuite_fs.h +++ b/libstdc++-v3/testsuite/util/testsuite_fs.h @@ -73,7 +73,7 @@ namespace __gnu_test { std::experimental::filesystem::path p; #if defined(_GNU_SOURCE) || _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L - char tmp[] = "test.XXXXXX"; + char tmp[] = "filesystem-ts-test.XXXXXX"; int fd = ::mkstemp(tmp); if (fd == -1) throw std::experimental::filesystem::filesystem_error("mkstemp failed", @@ -83,7 +83,11 @@ namespace __gnu_test p = tmp; #else char buf[64]; - std::sprintf(buf, "test.%lu", (unsigned long)::getpid()); +#if _GLIBCXX_USE_C99 + std::snprintf(buf, 64, "filesystem-ts-test.%lu", (unsigned long)::getpid()); +#else + std::sprintf(buf, "filesystem-ts-test.%lu", (unsigned long)::getpid()); +#endif p = buf; #endif return p; -- 2.30.2