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/execution_api | |
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/execution_api')
-rw-r--r-- | src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index 6a8ebb87..2f3dbc01 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -509,9 +509,7 @@ auto BazelMsgFactory::CreateDirectoryDigestFromLocalTree( // create and store file try { const auto full_name = root / name; - const bool is_executable = - FileSystemManager::IsExecutable(full_name, true); - if (auto digest = store_file(full_name, is_executable)) { + if (auto digest = store_file(full_name, IsExecutableObject(type))) { auto file = CreateFileNode(name.string(), type, {}); file.set_allocated_digest(gsl::owner<bazel_re::Digest*>{ new bazel_re::Digest{std::move(*digest)}}); @@ -568,15 +566,11 @@ auto BazelMsgFactory::CreateGitTreeDigestFromLocalTree( // create and store file try { const auto full_name = root / name; - const bool is_executable = - FileSystemManager::IsExecutable(full_name, true); - if (auto digest = store_file(full_name, is_executable)) { + if (auto digest = store_file(full_name, IsExecutableObject(type))) { if (auto raw_id = FromHexString( NativeSupport::Unprefix(digest->hash()))) { - entries[std::move(*raw_id)].emplace_back( - name.string(), - is_executable ? ObjectType::Executable - : ObjectType::File); + entries[std::move(*raw_id)].emplace_back(name.string(), + type); return true; } } |