From 5838493a3aaa7be688e56b65d13b343cc1336d8c Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 7 Dec 2017 14:21:13 +0900 Subject: [PATCH] bootspec: fix debug message about default entry When no entries matches with entry_oneshot, entry_default and default_pattern, then log message shows a wrong entry. Moreover, if none of entry_oneshot, entry_default and default_pattern are set, then the index `i` is uninitialized. This fixes such problem. --- src/shared/bootspec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 0481293a50c..f71205de5ba 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -374,7 +374,7 @@ int boot_entries_select_default(const BootConfig *config) { } if (config->n_entries > 0) - log_debug("Found default: last entry \"%s\"", config->entries[i].filename); + log_debug("Found default: last entry \"%s\"", config->entries[config->n_entries - 1].filename); else log_debug("Found no default boot entry :("); return config->n_entries - 1; /* -1 means "no default" */ -- 2.47.3