aboutsummaryrefslogtreecommitdiff
path: root/libc/system_properties/contexts_split.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/system_properties/contexts_split.cpp')
-rw-r--r--libc/system_properties/contexts_split.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libc/system_properties/contexts_split.cpp b/libc/system_properties/contexts_split.cpp
index 11db7ec68..f71d70aa7 100644
--- a/libc/system_properties/contexts_split.cpp
+++ b/libc/system_properties/contexts_split.cpp
@@ -114,8 +114,6 @@ static void ListFree(List** list) {
}
// The below two functions are duplicated from label_support.c in libselinux.
-// TODO: Find a location suitable for these functions such that both libc and
-// libselinux can share a common source file.
// The read_spec_entries and read_spec_entry functions may be used to
// replace sscanf to read entries from spec files. The file and
@@ -271,7 +269,7 @@ bool ContextsSplit::InitializeProperties() {
if (!InitializePropertiesFromFile("/system/etc/selinux/plat_property_contexts")) {
return false;
}
- // Don't check for failure here, so we always have a sane list of properties.
+ // Don't check for failure here, since we don't always have all of these partitions.
// E.g. In case of recovery, the vendor partition will not have mounted and we
// still need the system / platform properties to function.
if (access("/vendor/etc/selinux/vendor_property_contexts", R_OK) != -1) {
@@ -326,10 +324,16 @@ bool ContextsSplit::Initialize(bool writable, const char* filename, bool* fsetxa
return true;
}
-prop_area* ContextsSplit::GetPropAreaForName(const char* name) {
+PrefixNode* ContextsSplit::GetPrefixNodeForName(const char* name) {
auto entry = ListFind(prefixes_, [name](PrefixNode* l) {
return l->prefix[0] == '*' || !strncmp(l->prefix, name, l->prefix_len);
});
+
+ return entry;
+}
+
+prop_area* ContextsSplit::GetPropAreaForName(const char* name) {
+ auto entry = GetPrefixNodeForName(name);
if (!entry) {
return nullptr;
}