]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/bootspec: remember the full path to boot entry and use it in logging
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 26 Sep 2018 06:35:12 +0000 (08:35 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 8 Oct 2018 15:05:17 +0000 (17:05 +0200)
It's much easier to understand what is going on when the full path is
logged.

src/shared/bootspec.c
src/shared/bootspec.h

index 7a6399eaa7964963727ca54587a1cdf02fb34bb6..5d8471c51a88144b6eddeffd68e5d7b2ad3ec285 100644 (file)
@@ -24,6 +24,7 @@ void boot_entry_free(BootEntry *entry) {
         assert(entry);
 
         free(entry->id);
+        free(entry->path);
         free(entry->title);
         free(entry->show_title);
         free(entry->version);
@@ -57,6 +58,10 @@ int boot_entry_load(const char *path, BootEntry *entry) {
         if (!tmp.id)
                 return log_oom();
 
+        tmp.path = strdup(path);
+        if (!tmp.path)
+                return log_oom();
+
         f = fopen(path, "re");
         if (!f)
                 return log_error_errno(errno, "Failed to open \"%s\": %m", path);
@@ -625,6 +630,7 @@ int find_default_boot_entry(
         }
 
         *e = &config->entries[config->default_entry];
+        log_debug("Found default boot entry in file \"%s\"", (*e)->path);
 
         if (esp_where)
                 *esp_where = TAKE_PTR(where);
index e0fcaaea6f2999a70f58dd052f360d612dbec216..c39d773cb3402dd4b0b58c89e239d34b1b0470a8 100644 (file)
@@ -9,7 +9,8 @@
 #include "sd-id128.h"
 
 typedef struct BootEntry {
-        char *id;
+        char *id;       /* This is the file basename without extension */
+        char *path;     /* This is the full path to the file */
         char *title;
         char *show_title;
         char *version;