From a81cb496952ba092f9323a4a75c34fab082ddddc Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 26 Dec 2024 14:05:53 -0800 Subject: [PATCH] Revert "atf-check.cpp: remove unneeded copying into vector" --- atf-sh/atf-check.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/atf-sh/atf-check.cpp b/atf-sh/atf-check.cpp index 934ed121..f6ebc7a6 100644 --- a/atf-sh/atf-check.cpp +++ b/atf-sh/atf-check.cpp @@ -118,14 +118,16 @@ class temp_file : public std::ostream { const atf::fs::path file = atf::fs::path( atf::env::get("TMPDIR", "/tmp")) / pattern; - auto file_s = file.str(); - m_fd = ::mkstemp(file_s.data()); + std::string file_s = file.str(); + std::vector buf(file_s.begin(), file_s.end() + 1); + + m_fd = ::mkstemp(buf.data()); if (m_fd == -1) throw atf::system_error("atf_check::temp_file::temp_file(" + - file_s + ")", "mkstemp(3) failed", + file.str() + ")", "mkstemp(3) failed", errno); - m_path.reset(new atf::fs::path(file_s.data())); + m_path.reset(new atf::fs::path(buf.data())); } ~temp_file(void)