aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-07-01 08:35:50 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-07-01 08:35:53 +0200
commit4c29b63cfba31c83205111335b21b06af614c818 (patch)
tree143adeb7088f49eeed81dc1e479b711743059ab1
parent926f76cb205ce9ef085f4945cdb439746b140414 (diff)
parent7b0b201d109b6240f114498fc1b94af9cb85f26e (diff)
Merge bitcoin/bitcoin#22255: [0.21] wallet: Do not iterate a directory if having an error while accessing it
7b0b201d109b6240f114498fc1b94af9cb85f26e wallet: Do not iterate a directory if having an error while accessing it (Hennadii Stepanov) Pull request description: This change prevents infinite looping for, for example, system folders on Windows. Github-Pull: #21907 Rebased-From: 29c9e2c2d2015ade47ed4497926363dea3f9c59b Note: Trivial backport, but in a differently-named function in another file ACKs for top commit: hebasto: ACK 7b0b201d109b6240f114498fc1b94af9cb85f26e, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: d41ab267250e8bfd9289cacf1fd804cc1a3bb20fc479dc9da5a69ebf26530b552b11b2ee6b11e17a1c146ca792ee65bd64eeb2269fa5e73a70361da8a2a09925
-rw-r--r--src/wallet/walletutil.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp
index 88a52cdf63..0567aa8442 100644
--- a/src/wallet/walletutil.cpp
+++ b/src/wallet/walletutil.cpp
@@ -45,7 +45,12 @@ std::vector<fs::path> ListWalletDir()
for (auto it = fs::recursive_directory_iterator(wallet_dir, ec); it != fs::recursive_directory_iterator(); it.increment(ec)) {
if (ec) {
- LogPrintf("%s: %s %s\n", __func__, ec.message(), it->path().string());
+ if (fs::is_directory(*it)) {
+ it.no_push();
+ LogPrintf("%s: %s %s -- skipping.\n", __func__, ec.message(), it->path().string());
+ } else {
+ LogPrintf("%s: %s %s\n", __func__, ec.message(), it->path().string());
+ }
continue;
}