From 9429a398e291a1b5edcfc657b94fcaf52cd1d8f9 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Fri, 27 Nov 2020 12:41:07 +0000 Subject: Handle rename failure in DumpMempool(...) by using RenameOver(...) return value --- src/validation.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index 71402ef263..9197daec80 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5110,7 +5110,9 @@ bool DumpMempool(const CTxMemPool& pool) if (!FileCommit(file.Get())) throw std::runtime_error("FileCommit failed"); file.fclose(); - RenameOver(GetDataDir() / "mempool.dat.new", GetDataDir() / "mempool.dat"); + if (!RenameOver(GetDataDir() / "mempool.dat.new", GetDataDir() / "mempool.dat")) { + throw std::runtime_error("Rename failed"); + } int64_t last = GetTimeMicros(); LogPrintf("Dumped mempool: %gs to copy, %gs to dump\n", (mid-start)*MICRO, (last-mid)*MICRO); } catch (const std::exception& e) { -- cgit v1.2.3