OSDN Git Service

properties: do not fail in the absence of vendor properties
authorSandeep Patil <sspatil@google.com>
Wed, 17 May 2017 18:33:37 +0000 (11:33 -0700)
committerSandeep Patil <sspatil@google.com>
Wed, 17 May 2017 23:26:59 +0000 (16:26 -0700)
/vendor is not mounted in recovery and so the property initialization
must not fail if the vendor property context is not found.

Bug: 38212419
Test: boot into recovery, mount system and run adb shell getprop

Change-Id: I9f7c2fe2b20da86194eff8e7bf94b2352e50bf27
Signed-off-by: Sandeep Patil <sspatil@google.com>
libc/bionic/system_properties.cpp

index 09106ad..68f4501 100644 (file)
@@ -1047,16 +1047,15 @@ static bool initialize_properties() {
     if (!initialize_properties_from_file("/system/etc/selinux/plat_property_contexts")) {
       return false;
     }
-    if (!initialize_properties_from_file("/vendor/etc/selinux/nonplat_property_contexts")) {
-      return false;
-    }
+    // Don't check for failure here, so we always have a sane list of properties.
+    // E.g. In case of recovery, the vendor partition will not have mounted and we
+    // still need the system / platform properties to function.
+    initialize_properties_from_file("/vendor/etc/selinux/nonplat_property_contexts");
   } else {
     if (!initialize_properties_from_file("/plat_property_contexts")) {
       return false;
     }
-    if (!initialize_properties_from_file("/nonplat_property_contexts")) {
-      return false;
-    }
+    initialize_properties_from_file("/nonplat_property_contexts");
   }
 
   return true;