From 2d3bfb6904e2a855eebf1e8273fe2d21dc363077 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 26 Sep 2018 08:35:12 +0200 Subject: [PATCH] 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. --- src/shared/bootspec.c | 6 ++++++ src/shared/bootspec.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) 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; -- 2.47.3