Make parse prop file a util function

This commit is contained in:
topjohnwu
2019-03-05 20:27:09 -05:00
parent b278d07b05
commit 04ef1e6405
8 changed files with 35 additions and 59 deletions

View File

@@ -233,7 +233,7 @@ bool init_list() {
// Migrate old hide list into database
if (access(LEGACY_LIST, R_OK) == 0) {
file_readline(LEGACY_LIST, [](string_view &s) -> bool {
file_readline(LEGACY_LIST, [](string_view s) -> bool {
add_list(s.data());
return true;
});

View File

@@ -79,7 +79,7 @@ static long xptrace(int request, pid_t pid, void *addr = nullptr, intptr_t data
return xptrace(true, request, pid, addr, reinterpret_cast<void *>(data));
}
static bool parse_packages_xml(string_view &s) {
static bool parse_packages_xml(string_view s) {
if (!str_starts(s, "<package "))
return true;
/* <package key1="value1" key2="value2"....> */
@@ -144,7 +144,7 @@ static void hide_daemon(int pid) {
vector<string> targets;
// Unmount dummy skeletons and /sbin links
file_readline("/proc/self/mounts", [&](string_view &s) -> bool {
file_readline("/proc/self/mounts", [&](string_view s) -> bool {
if (str_contains(s, "tmpfs /system/") || str_contains(s, "tmpfs /vendor/") ||
str_contains(s, "tmpfs /sbin")) {
char *path = (char *) s.data();
@@ -160,7 +160,7 @@ static void hide_daemon(int pid) {
targets.clear();
// Unmount everything under /system, /vendor, and data mounts
file_readline("/proc/self/mounts", [&](string_view &s) -> bool {
file_readline("/proc/self/mounts", [&](string_view s) -> bool {
if ((str_contains(s, " /system/") || str_contains(s, " /vendor/")) &&
(str_contains(s, system_block) || str_contains(s, vendor_block) ||
str_contains(s, data_block))) {