From 4f65af97b408663c39ee83c5015956dbfc642dfe Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 29 Apr 2019 20:48:17 +0300 Subject: Remove dead code for walletFile check SplitWalletPath() garanties the walletFile is a plain filename without a directory. --- src/wallet/db.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 6a326bfd97..fb3bb12a7a 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -407,13 +407,6 @@ bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, std::string& er LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(nullptr, nullptr, nullptr)); LogPrintf("Using wallet %s\n", file_path.string()); - // Wallet file must be a plain filename without a directory - if (walletFile != fs::basename(walletFile) + fs::extension(walletFile)) - { - errorStr = strprintf(_("Wallet %s resides outside wallet directory %s"), walletFile, walletDir.string()); - return false; - } - if (!env->Open(true /* retry */)) { errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir); return false; -- cgit v1.2.3 From a0a222eec0b7f615a756e5e0dcec9b02296f999c Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 29 Apr 2019 21:15:52 +0300 Subject: Replace deprecated Boost Filesystem function Boost Filesystem basename() function is deprecated since v1.36.0. Also, defining BOOST_FILESYSTEM_NO_DEPRECATED before including filesystem headers is strongly recommended. This prevents inadvertent use of old features, particularly legacy function names, that have been replaced and are going to go away in the future. --- src/dbwrapper.cpp | 2 +- src/fs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 58d8cc2c9d..34896f7ab2 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -115,7 +115,7 @@ static leveldb::Options GetOptions(size_t nCacheSize) } CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate) - : m_name(fs::basename(path)) + : m_name{path.stem().string()} { penv = nullptr; readoptions.verify_checksums = true; diff --git a/src/fs.h b/src/fs.h index 8af81f173b..c713297d6e 100644 --- a/src/fs.h +++ b/src/fs.h @@ -11,6 +11,7 @@ #include #endif +#define BOOST_FILESYSTEM_NO_DEPRECATED #include #include -- cgit v1.2.3