From f5d7278fbe047c15d9d637b33aeb91865ddecb1e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 24 Nov 2015 16:30:49 +0200 Subject: Account for dangling/inaccessible links --- build/file.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'build') 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 (de.path ())); -- cgit v1.1