summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-08-08 23:20:48 +0200
committerCarl Hetherington <cth@carlh.net>2022-08-13 11:04:23 +0200
commit0664b92293ec8dd4fec4015981af7610a9e1984c (patch)
tree706302af9c5587f81143817d077ad2ac11cd9a06
parent9711854702ac81063e0a4a11067b9ff50d481e59 (diff)
Fix crashes when the find-missing code finds an inacessible directory (#2291).
-rw-r--r--src/lib/find_missing.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/find_missing.cc b/src/lib/find_missing.cc
index 3d61e74bd..2234637b3 100644
--- a/src/lib/find_missing.cc
+++ b/src/lib/find_missing.cc
@@ -37,7 +37,8 @@ static
void
search (Replacements& replacement_paths, boost::filesystem::path directory, int depth = 0)
{
- for (auto candidate: boost::filesystem::directory_iterator(directory)) {
+ boost::system::error_code ec;
+ for (auto candidate: boost::filesystem::directory_iterator(directory, ec)) {
if (boost::filesystem::is_regular_file(candidate.path())) {
for (auto& replacement: replacement_paths) {
for (auto& path: replacement.second) {
@@ -50,6 +51,10 @@ search (Replacements& replacement_paths, boost::filesystem::path directory, int
search (replacement_paths, candidate, depth + 1);
}
}
+
+ /* Just ignore errors when creating the directory_iterator; they can be triggered by things like
+ * macOS' love of creating random directories (see #2291).
+ */
}