From: Lennart Poettering Date: Thu, 5 Jan 2023 19:41:20 +0000 (+0100) Subject: bootspec: show default/selected entry info in JSON output X-Git-Tag: v253-rc1~177 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a6c6d35e48adb4b4c404f34a03455e6baca9359;p=thirdparty%2Fsystemd.git bootspec: show default/selected entry info in JSON output Fixes: #25889 --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 2a47f30b8f3..36a9f1d8bd2 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -1441,7 +1441,10 @@ int show_boot_entries(const BootConfig *config, JsonFormatFlags json_format) { * at once. */ r = json_append(&v, JSON_BUILD_OBJECT( JSON_BUILD_PAIR_CONDITION(e->tries_left != UINT_MAX, "triesLeft", JSON_BUILD_UNSIGNED(e->tries_left)), - JSON_BUILD_PAIR_CONDITION(e->tries_done != UINT_MAX, "triesDone", JSON_BUILD_UNSIGNED(e->tries_done)))); + JSON_BUILD_PAIR_CONDITION(e->tries_done != UINT_MAX, "triesDone", JSON_BUILD_UNSIGNED(e->tries_done)), + JSON_BUILD_PAIR_CONDITION(config->default_entry >= 0, "isDefault", JSON_BUILD_BOOLEAN(i == (size_t) config->default_entry)), + JSON_BUILD_PAIR_CONDITION(config->selected_entry >= 0, "isSelected", JSON_BUILD_BOOLEAN(i == (size_t) config->selected_entry)))); + if (r < 0) return log_oom();