Skip to content

Commit

Permalink
wallet: Add missing check for backup to source wallet file.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Jul 21, 2021
1 parent d9e1c6b commit d86cd4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wallet/db.cpp
Expand Up @@ -767,6 +767,11 @@ bool CWalletDBWrapper::Backup(const std::string& strDest)
pathDest /= strFile;

try {
if (fs::equivalent(pathSrc, pathDest)) {
LogPrintf("cannot backup to wallet source file %s\n", pathDest.string());
return false;
}

#if BOOST_VERSION >= 107400
fs::copy_file(pathSrc.c_str(), pathDest, fs::copy_options::overwrite_existing);
#elif BOOST_VERSION >= 105800 /* BOOST_LIB_VERSION 1_58 */
Expand Down

0 comments on commit d86cd4f

Please sign in to comment.