StartsWith now allows std::string prefixes.

Bug: N/A
Test: builds
Change-Id: I2e24632e95f2bf929c2c000152c5c4076d53186e
This commit is contained in:
Elliott Hughes 2017-12-20 12:38:47 -08:00
parent 401b260351
commit 32a5b9aed3
2 changed files with 3 additions and 3 deletions

View file

@ -52,7 +52,7 @@ static bool checkMaps(const std::string& path, const std::string& prefix) {
std::string::size_type pos = line.find('/'); std::string::size_type pos = line.find('/');
if (pos != std::string::npos) { if (pos != std::string::npos) {
line = line.substr(pos); line = line.substr(pos);
if (android::base::StartsWith(line, prefix.c_str())) { if (android::base::StartsWith(line, prefix)) {
LOG(WARNING) << "Found map " << path << " referencing " << line; LOG(WARNING) << "Found map " << path << " referencing " << line;
found = true; found = true;
} }
@ -64,7 +64,7 @@ static bool checkMaps(const std::string& path, const std::string& prefix) {
static bool checkSymlink(const std::string& path, const std::string& prefix) { static bool checkSymlink(const std::string& path, const std::string& prefix) {
std::string res; std::string res;
if (android::base::Readlink(path, &res)) { if (android::base::Readlink(path, &res)) {
if (android::base::StartsWith(res, prefix.c_str())) { if (android::base::StartsWith(res, prefix)) {
LOG(WARNING) << "Found symlink " << path << " referencing " << res; LOG(WARNING) << "Found symlink " << path << " referencing " << res;
return true; return true;
} }

View file

@ -426,7 +426,7 @@ static int unmount_tree(const std::string& prefix) {
mntent* mentry; mntent* mentry;
while ((mentry = getmntent(fp)) != NULL) { while ((mentry = getmntent(fp)) != NULL) {
auto test = std::string(mentry->mnt_dir) + "/"; auto test = std::string(mentry->mnt_dir) + "/";
if (android::base::StartsWith(test, prefix.c_str())) { if (android::base::StartsWith(test, prefix)) {
toUnmount.push_front(test); toUnmount.push_front(test);
} }
} }