diff options
author | 2022-02-18 05:08:29 +0000 | |
---|---|---|
committer | 2022-02-18 05:08:29 +0000 | |
commit | 1f4b4548bc72d85939852147fdd5bf08313fc293 (patch) | |
tree | be7f06cc694b8b83fb154282c132464b9730b727 /cmds/installd/utils.cpp | |
parent | c847c919e02ae56d92cff1875e3fdca7cc74495f (diff) | |
parent | 8e025ea1552340a1011b7561825fb6edcdbba0e7 (diff) |
Merge "Revert Android.bp changes." am: 013fa056bb am: 4f2d030336 am: 8e025ea155
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1990472
Change-Id: Id72f26e0e1e88a3e6e376c2ad173e9436a224883
Diffstat (limited to 'cmds/installd/utils.cpp')
-rw-r--r-- | cmds/installd/utils.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp index 1afac576f9..3ce4b67d9a 100644 --- a/cmds/installd/utils.cpp +++ b/cmds/installd/utils.cpp @@ -674,8 +674,12 @@ static int rename_delete_dir_contents(const std::string& pathname, return delete_dir_contents(temp_dir_path.c_str(), 1, exclusion_predicate, ignore_if_missing); } -bool is_renamed_deleted_dir(std::string_view path) { - return path.ends_with(deletedSuffix); +bool is_renamed_deleted_dir(const std::string& path) { + if (path.size() < deletedSuffix.size()) { + return false; + } + std::string_view pathSuffix{path.c_str() + path.size() - deletedSuffix.size()}; + return pathSuffix == deletedSuffix; } int rename_delete_dir_contents_and_dir(const std::string& pathname, bool ignore_if_missing) { |