summaryrefslogtreecommitdiff
path: root/cmds/installd/utils.cpp
diff options
context:
space:
mode:
author Alex Buynytskyy <alexbuy@google.com> 2022-02-17 21:20:10 +0000
committer Alex Buynytskyy <alexbuy@google.com> 2022-02-17 23:22:10 +0000
commit4ab5d534b1573cb13205baba9d42caab6bcd907e (patch)
tree658e05195733ef61f1ab42c23b3ca867193240cd /cmds/installd/utils.cpp
parent53cf8183f841f11ca3cff5e662ab0176b0757a13 (diff)
Revert Android.bp changes.
Aparently they are causing device reboots. Bug: 219588776 Bug: 219650739 Test: android.host.multiuser.EphemeralTest#testRemoveUserWhenPossible_currentUserSetEphemeral_removeAfterSwitch Change-Id: I030b9529c16945b5ef87c9087fe4d0fd90fc1865
Diffstat (limited to 'cmds/installd/utils.cpp')
-rw-r--r--cmds/installd/utils.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index 8a00be9193..faccded34b 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -637,8 +637,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) {