summaryrefslogtreecommitdiff
path: root/libarttools/tools/tools.cc
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2023-04-25 14:50:23 +0100
committer Jiakai Zhang <jiakaiz@google.com> 2023-04-28 09:16:07 +0000
commitea71e000b1c9ace90f089c37a7e01686e6fda6eb (patch)
tree4dc980fcf36dd06ed388401e920ab4cad0508b89 /libarttools/tools/tools.cc
parentcddee79d14036a337dd2d9fb7882fb1da2fe42eb (diff)
Don't throw when walking through a directory.
Bug: 279577516 Test: m test-art-host-gtest-art_libarttools_tests Ignore-AOSP-First: ART Services Change-Id: I7ea491f9605f9735cf11f2bb6644594b28e6aa0b
Diffstat (limited to 'libarttools/tools/tools.cc')
-rw-r--r--libarttools/tools/tools.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/libarttools/tools/tools.cc b/libarttools/tools/tools.cc
index 6c87969c04..3d5301ad7f 100644
--- a/libarttools/tools/tools.cc
+++ b/libarttools/tools/tools.cc
@@ -100,8 +100,8 @@ void MatchGlobRecursive(const std::vector<std::filesystem::path>& patterns,
std::error_code ec;
for (auto it = std::filesystem::recursive_directory_iterator(
root_dir, std::filesystem::directory_options::skip_permission_denied, ec);
- it != std::filesystem::end(it);
- it++) {
+ !ec && it != std::filesystem::end(it);
+ it.increment(ec)) {
const std::filesystem::directory_entry& entry = *it;
if (std::none_of(patterns.begin(), patterns.end(), std::bind(PartialMatch, _1, entry.path()))) {
// Avoid unnecessary I/O and SELinux denials.