mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-28 01:41:57 +02:00
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.
This commit is contained in:
parent
32692d2681
commit
29c9e2c2d2
@ -18,7 +18,12 @@ std::vector<fs::path> ListDatabases(const fs::path& wallet_dir)
|
|||||||
|
|
||||||
for (auto it = fs::recursive_directory_iterator(wallet_dir, ec); it != fs::recursive_directory_iterator(); it.increment(ec)) {
|
for (auto it = fs::recursive_directory_iterator(wallet_dir, ec); it != fs::recursive_directory_iterator(); it.increment(ec)) {
|
||||||
if (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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user