aboutsummaryrefslogtreecommitdiff
path: root/atf-sh/atf-check.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'atf-sh/atf-check.cpp')
-rw-r--r--atf-sh/atf-check.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/atf-sh/atf-check.cpp b/atf-sh/atf-check.cpp
index b08c020e95d5..866b7bb483a2 100644
--- a/atf-sh/atf-check.cpp
+++ b/atf-sh/atf-check.cpp
@@ -1,6 +1,3 @@
-//
-// Automated Testing Framework (atf)
-//
// Copyright (c) 2008 The NetBSD Foundation, Inc.
// All rights reserved.
//
@@ -25,7 +22,6 @@
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
extern "C" {
#include <sys/types.h>
@@ -48,10 +44,9 @@ extern "C" {
#include <utility>
#include "atf-c++/check.hpp"
-#include "atf-c++/config.hpp"
-
#include "atf-c++/detail/application.hpp"
#include "atf-c++/detail/auto_array.hpp"
+#include "atf-c++/detail/env.hpp"
#include "atf-c++/detail/exceptions.hpp"
#include "atf-c++/detail/fs.hpp"
#include "atf-c++/detail/process.hpp"
@@ -112,17 +107,20 @@ class temp_file : public std::ostream {
int m_fd;
public:
- temp_file(const atf::fs::path& p) :
+ temp_file(const char* pattern) :
std::ostream(NULL),
m_fd(-1)
{
- atf::auto_array< char > buf(new char[p.str().length() + 1]);
- std::strcpy(buf.get(), p.c_str());
+ const atf::fs::path file = atf::fs::path(
+ atf::env::get("TMPDIR", "/tmp")) / pattern;
+
+ atf::auto_array< char > buf(new char[file.str().length() + 1]);
+ std::strcpy(buf.get(), file.c_str());
m_fd = ::mkstemp(buf.get());
if (m_fd == -1)
throw atf::system_error("atf_check::temp_file::temp_file(" +
- p.str() + ")", "mkstemp(3) failed",
+ file.str() + ")", "mkstemp(3) failed",
errno);
m_path.reset(new atf::fs::path(buf.get()));
@@ -350,7 +348,7 @@ execute_with_shell(char* const* argv)
const std::string cmd = flatten_argv(argv);
const char* sh_argv[4];
- sh_argv[0] = atf::config::get("atf_shell").c_str();
+ sh_argv[0] = atf::env::get("ATF_SHELL", ATF_SHELL).c_str();
sh_argv[1] = "-c";
sh_argv[2] = cmd.c_str();
sh_argv[3] = NULL;
@@ -623,9 +621,7 @@ run_output_check(const output_check oc, const atf::fs::path& path,
} else if (oc.type == oc_ignore) {
result = true;
} else if (oc.type == oc_inline) {
- atf::fs::path path2 = atf::fs::path(atf::config::get("atf_workdir"))
- / "inline.XXXXXX";
- temp_file temp(path2);
+ temp_file temp("atf-check.XXXXXX");
temp.write(decode(oc.value));
temp.close();