aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/file.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/build/file.cxx b/build/file.cxx
index 278cd5d..7e3555f 100644
--- a/build/file.cxx
+++ b/build/file.cxx
@@ -357,8 +357,19 @@ namespace build
for (const dir_entry& de: dir_iterator (d))
{
- if (de.type () != entry_type::directory)
+ // If this is a link, then type() will try to stat() it. And if
+ // the link is dangling or points to something inaccessible, it
+ // will fail.
+ //
+ try
+ {
+ if (de.type () != entry_type::directory)
+ continue;
+ }
+ catch (const system_error& e)
+ {
continue;
+ }
dir_path sd (d / path_cast<dir_path> (de.path ()));