]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootspec: fix debug message about default entry
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 7 Dec 2017 05:21:13 +0000 (14:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 7 Dec 2017 05:50:49 +0000 (14:50 +0900)
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

index 0481293a50c14abb7f5c1717321da03ffd11d53f..f71205de5ba16bfc8eaa26a1267a3ffb2a5dd397 100644 (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" */