From bb54c2f879f75f701a6732df4cafc33ecdec6a44 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Wed, 17 Feb 2016 11:03:06 +0100 Subject: [PATCH] When removing a block, check whether it was successful --- src/blockstore/implementations/ondisk/OnDiskBlock.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/blockstore/implementations/ondisk/OnDiskBlock.cpp b/src/blockstore/implementations/ondisk/OnDiskBlock.cpp index 36dbd390..c155d760 100644 --- a/src/blockstore/implementations/ondisk/OnDiskBlock.cpp +++ b/src/blockstore/implementations/ondisk/OnDiskBlock.cpp @@ -81,7 +81,10 @@ optional> OnDiskBlock::CreateOnDisk(const bf::path &root void OnDiskBlock::RemoveFromDisk(const bf::path &rootdir, const Key &key) { auto filepath = rootdir / key.ToString(); ASSERT(bf::is_regular_file(filepath), "Block not found on disk"); - bf::remove(filepath); + bool retval = bf::remove(filepath); + if (!retval) { + throw std::runtime_error("Couldn't find block to remove"); + } } void OnDiskBlock::_storeToDisk() const {