aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-05-10 21:45:18 +0300
committerLuke Dashjr <luke-jr+git@utopios.org>2021-06-15 19:02:45 +0000
commit7b0b201d109b6240f114498fc1b94af9cb85f26e (patch)
tree31c6951029a6ab877c8572502d6ebb81b8c6dc0c /src
parent8afa602f308ef003bb6893718eae1fe5a830690c (diff)
wallet: Do not iterate a directory if having an error while accessing it
This change prevents infinite looping for, for example, system folders on Windows. Github-Pull: #21907 Rebased-From: 29c9e2c2d2015ade47ed4497926363dea3f9c59b
Diffstat (limited to 'src')
-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 04c2407a89..f8827604ba 100644
--- a/src/wallet/walletutil.cpp
+++ b/src/wallet/walletutil.cpp
@@ -63,7 +63,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;
}