From 0026331ce0177bd3f902628aadcd1a84f3e2547d Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 24 Jan 2023 12:41:23 +0100 Subject: FileSystemManager: Do not follow symlinks ... and ensure that cascades of checks are performed with only a single filesystem stat per method. --- src/buildtool/file_system/file_root.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/buildtool/file_system/file_root.hpp') diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp index 726171b8..a1b21a81 100644 --- a/src/buildtool/file_system/file_root.hpp +++ b/src/buildtool/file_system/file_root.hpp @@ -186,8 +186,7 @@ class FileRoot { if (std::holds_alternative(data_)) { auto const& data = std::get(data_); auto it = data.find(name); - return (it != data.end() and - it->second == ObjectType::File); + return (it != data.end() and IsFileObject(it->second)); } } catch (...) { } @@ -238,7 +237,7 @@ class FileRoot { auto const& data = std::get(data_); return Iterator{FilteredIterator{ data.begin(), data.end(), [](auto const& x) { - return x.second == ObjectType::File; + return IsFileObject(x.second); }}}; } // std::holds_alternative(data_) == true @@ -254,7 +253,7 @@ class FileRoot { auto const& data = std::get(data_); return Iterator{FilteredIterator{ data.begin(), data.end(), [](auto const& x) { - return x.second == ObjectType::Tree; + return IsTreeObject(x.second); }}}; } -- cgit v1.2.3