}
static inline char *
-get_aboot_root_slot (void)
+get_aboot_root_slot (const char *slot_suffix)
{
- autofree char *slot_suffix = read_proc_cmdline_key ("androidboot.slot_suffix");
- if (!slot_suffix)
- errx (EXIT_FAILURE, "Missing androidboot.slot_suffix");
-
if (strcmp (slot_suffix, "_a") == 0)
return strdup ("/ostree/root.a");
else if (strcmp (slot_suffix, "_b") == 0)
static inline char *
get_ostree_target (void)
{
- autofree char *ostree_cmdline = read_proc_cmdline_key ("ostree");
-
- if (!ostree_cmdline)
- return NULL;
-
- if (strcmp (ostree_cmdline, "aboot") == 0)
- return get_aboot_root_slot ();
+ autofree char *slot_suffix = read_proc_cmdline_key ("androidboot.slot_suffix");
+ if (slot_suffix)
+ return get_aboot_root_slot (slot_suffix);
- return steal_pointer (&ostree_cmdline);
+ return read_proc_cmdline_key ("ostree");
}
/* This is an API for other projects to determine whether or not the