diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-05-10 21:45:18 +0300 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2021-06-15 19:02:45 +0000 |
commit | 7b0b201d109b6240f114498fc1b94af9cb85f26e (patch) | |
tree | 31c6951029a6ab877c8572502d6ebb81b8c6dc0c /src | |
parent | 8afa602f308ef003bb6893718eae1fe5a830690c (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.cpp | 7 |
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; } |