diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-01-24 12:41:23 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-01-24 18:06:22 +0100 |
commit | 0026331ce0177bd3f902628aadcd1a84f3e2547d (patch) | |
tree | 328591a6214723d785c8348ed7d5216d020beba7 /src/buildtool/file_system/file_root.hpp | |
parent | de17042b3c3296e0605f73df771111c6af49ca61 (diff) | |
download | justbuild-0026331ce0177bd3f902628aadcd1a84f3e2547d.tar.gz |
FileSystemManager: Do not follow symlinks
... and ensure that cascades of checks are performed with
only a single filesystem stat per method.
Diffstat (limited to 'src/buildtool/file_system/file_root.hpp')
-rw-r--r-- | src/buildtool/file_system/file_root.hpp | 7 |
1 files changed, 3 insertions, 4 deletions
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<pairs_t>(data_)) { auto const& data = std::get<pairs_t>(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<pairs_t>(data_); return Iterator{FilteredIterator{ data.begin(), data.end(), [](auto const& x) { - return x.second == ObjectType::File; + return IsFileObject(x.second); }}}; } // std::holds_alternative<tree_t>(data_) == true @@ -254,7 +253,7 @@ class FileRoot { auto const& data = std::get<pairs_t>(data_); return Iterator{FilteredIterator{ data.begin(), data.end(), [](auto const& x) { - return x.second == ObjectType::Tree; + return IsTreeObject(x.second); }}}; } |