Merge "Add default executable permission in odm/bin"

This commit is contained in:
Tom Cherry 2019-05-08 15:31:28 +00:00 committed by Gerrit Code Review
commit 766e878253

View file

@ -214,6 +214,7 @@ static const struct fs_path_config android_files[] = {
{ 00755, AID_ROOT, AID_ROOT, 0, "bin/*" }, { 00755, AID_ROOT, AID_ROOT, 0, "bin/*" },
{ 00640, AID_ROOT, AID_SHELL, 0, "fstab.*" }, { 00640, AID_ROOT, AID_SHELL, 0, "fstab.*" },
{ 00750, AID_ROOT, AID_SHELL, 0, "init*" }, { 00750, AID_ROOT, AID_SHELL, 0, "init*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "odm/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "product/bin/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "product/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" },
@ -292,20 +293,21 @@ static bool fs_config_cmp(bool dir, const char* prefix, size_t len, const char*
const int fnm_flags = FNM_NOESCAPE; const int fnm_flags = FNM_NOESCAPE;
if (fnmatch(pattern.c_str(), input.c_str(), fnm_flags) == 0) return true; if (fnmatch(pattern.c_str(), input.c_str(), fnm_flags) == 0) return true;
static constexpr const char* kSystem = "system/"; // Check match between logical partition's files and patterns.
if (StartsWith(input, kSystem)) { static constexpr const char* kLogicalPartitions[] = {"system/product/",
input.erase(0, strlen(kSystem)); "system/product_services/",
} else if (input.size() <= strlen(kSystem)) { "system/vendor/",
return false; "vendor/odm/"};
} else if (StartsWith(pattern, kSystem)) { for (auto& logical_partition : kLogicalPartitions) {
pattern.erase(0, strlen(kSystem)); if (StartsWith(input, logical_partition)) {
} else { std::string input_in_partition = input.substr(input.find('/') + 1);
return false; if (!is_partition(input_in_partition)) continue;
if (fnmatch(pattern.c_str(), input_in_partition.c_str(), fnm_flags) == 0) {
return true;
}
}
} }
return false;
if (!is_partition(pattern)) return false;
if (!is_partition(input)) return false;
return fnmatch(pattern.c_str(), input.c_str(), fnm_flags) == 0;
} }
#ifndef __ANDROID_VNDK__ #ifndef __ANDROID_VNDK__
auto __for_testing_only__fs_config_cmp = fs_config_cmp; auto __for_testing_only__fs_config_cmp = fs_config_cmp;