projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9711854
)
Fix crashes when the find-missing code finds an inacessible directory (#2291).
author
Carl Hetherington
<cth@carlh.net>
Mon, 8 Aug 2022 21:20:48 +0000
(23:20 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Sat, 13 Aug 2022 09:04:23 +0000
(11:04 +0200)
src/lib/find_missing.cc
patch
|
blob
|
history
diff --git
a/src/lib/find_missing.cc
b/src/lib/find_missing.cc
index 3d61e74bd4f9b2b330f92ea7ba9c5e2bfc73293c..2234637b3150aaa334d245040b172d3caa02adba 100644
(file)
--- 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)
{
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) {
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);
}
}
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).
+ */
}
}