diff options
author | Jack Lloyd <[email protected]> | 2017-09-29 18:49:26 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-29 18:49:26 -0400 |
commit | 1d64169d941b3be81937c341e1b8e38cb5155057 (patch) | |
tree | 58b1a85739611e9472e297d80159495ca4faf37f | |
parent | 49f788d06a84cf2da15ba9d89ee49efb2ff688b7 (diff) |
Check return value of std::remove in test
Coverity find
-rw-r--r-- | src/tests/test_filters.cpp | 7 |
1 files 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; } |