From: Yu Watanabe Date: Thu, 7 Dec 2017 05:21:13 +0000 (+0900) Subject: bootspec: fix debug message about default entry X-Git-Tag: v236~48^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5838493a3aaa7be688e56b65d13b343cc1336d8c;p=thirdparty%2Fsystemd.git 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. --- 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" */