From 1d64169d941b3be81937c341e1b8e38cb5155057 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 29 Sep 2017 18:49:26 -0400 Subject: Check return value of std::remove in test Coverity find --- src/tests/test_filters.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tests/test_filters.cpp b/src/tests/test_filters.cpp index 6f83501d7..f48431579 100644 --- a/src/tests/test_filters.cpp +++ b/src/tests/test_filters.cpp @@ -139,7 +139,7 @@ class Filter_Tests final : public Test Test::Result result("DataSinkFlush"); #if defined(BOTAN_HAS_CODEC_FILTERS) && defined(BOTAN_TARGET_OS_HAS_FILESYSTEM) - std::string tmp_name("botan_test_data_src_sink_flush.tmp"); + const std::string tmp_name("botan_test_data_src_sink_flush.tmp"); std::ofstream outfile(tmp_name); Botan::Pipe pipe(new Botan::Hex_Decoder, new Botan::DataSink_Stream(outfile)); @@ -154,7 +154,10 @@ class Filter_Tests final : public Test result.test_eq("output string", ss.str(), "efgh"); - std::remove(tmp_name.c_str()); + if(std::remove(tmp_name.c_str()) != 0) + { + result.test_failure("Failed to remove temporary file at conclusion of test"); + } #endif return result; } -- cgit v1.2.3