Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d22186e4 authored by Tianjie Xu's avatar Tianjie Xu Committed by Automerger Merge Worker
Browse files

Merge "updater: Do not null terminate mount_flags_list array" am: be54337f...

Merge "updater: Do not null terminate mount_flags_list array" am: be54337f am: 44cea7ef am: ef498262

Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/1590176

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id1ca98bbad9a75c4ea6243627f286f3f3613d515
parents 39e0f595 ef498262
Loading
Loading
Loading
Loading
+18 −22
Original line number Diff line number Diff line
@@ -44,10 +44,8 @@ std::string UpdaterRuntime::FindBlockDeviceName(const std::string_view name) con
  return std::string(name);
}

static struct {
  const char* name;
  unsigned flag;
} mount_flags_list[] = {
static bool setMountFlag(const std::string& flag, unsigned* mount_flags) {
  static constexpr std::pair<const char*, unsigned> mount_flags_list[] = {
    { "noatime", MS_NOATIME },
    { "noexec", MS_NOEXEC },
    { "nosuid", MS_NOSUID },
@@ -63,10 +61,8 @@ static struct {
    { "slave", MS_SLAVE },
    { "shared", MS_SHARED },
    { "defaults", 0 },
  { 0, 0 },
  };

static bool setMountFlag(const std::string& flag, unsigned* mount_flags) {
  for (const auto& [name, value] : mount_flags_list) {
    if (flag == name) {
      *mount_flags |= value;