summaryrefslogtreecommitdiff
path: root/libc/system_properties/contexts_split.cpp
diff options
context:
space:
mode:
authorJustin DeMartino <jjdemartino@google.com>2020-09-21 13:23:58 -0700
committerJustin DeMartino <jjdemartino@google.com>2020-09-21 13:23:58 -0700
commit7e4fe6a28b718ab97c08811566238af2893ca65b (patch)
tree5413a5ec890b5a1ac4fbbe4548b5014e41a2591b /libc/system_properties/contexts_split.cpp
parentdcdcb3fa15004669823a3a118189d9d72ff30852 (diff)
parentab08b955a34423d53b28a6210e7530e67241af4a (diff)
Merge SP1A.200921.001
Change-Id: Id2ab019914bb555dadf52c46b8403c0d5fb3c20a
Diffstat (limited to 'libc/system_properties/contexts_split.cpp')
-rw-r--r--libc/system_properties/contexts_split.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libc/system_properties/contexts_split.cpp b/libc/system_properties/contexts_split.cpp
index 96b01a47c..f71d70aa7 100644
--- a/libc/system_properties/contexts_split.cpp
+++ b/libc/system_properties/contexts_split.cpp
@@ -269,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) {
@@ -324,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;
}