From: Zbigniew Jędrzejewski-Szmek Date: Wed, 26 Sep 2018 06:35:12 +0000 (+0200) Subject: shared/bootspec: remember the full path to boot entry and use it in logging X-Git-Tag: v240~611^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d3bfb6904e2a855eebf1e8273fe2d21dc363077;p=thirdparty%2Fsystemd.git shared/bootspec: remember the full path to boot entry and use it in logging It's much easier to understand what is going on when the full path is logged. --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 7a6399eaa79..5d8471c51a8 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -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); diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index e0fcaaea6f2..c39d773cb34 100644 --- a/src/shared/bootspec.h +++ b/src/shared/bootspec.h @@ -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;