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.
This commit is contained in:
Yu Watanabe 2017-12-07 14:21:13 +09:00
parent dd014eebfb
commit 5838493a3a
1 changed files with 1 additions and 1 deletions

View File

@ -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" */