From a2ae0d4969b1e60cf82094c1635985d55cb1e9ac Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 12 Aug 2019 00:04:44 +0900 Subject: [PATCH 1/2] bootctl: clear arg_xbootldr_path when acquire_xbootldr() succeeds --- src/boot/bootctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 9ecd9f78f3..d0bea6a946 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -103,6 +103,7 @@ static int acquire_xbootldr(bool unprivileged_mode, sd_id128_t *ret_uuid) { log_debug_errno(r, "Didn't find an XBOOTLDR partition, using the ESP as $BOOT."); if (ret_uuid) *ret_uuid = SD_ID128_NULL; + arg_xbootldr_path = mfree(arg_xbootldr_path); return 0; } if (r < 0) From f8a2b09a1890d7de5ea82b1cf51608afa4fe5de7 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 12 Aug 2019 00:05:28 +0900 Subject: [PATCH 2/2] bootctl: arg_dolloar_boot_path() may return NULL --- src/boot/bootctl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index d0bea6a946..ddc267401f 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -1176,7 +1176,11 @@ static int verb_status(int argc, char *argv[], void *userdata) { if (r < 0) return r; - puts(arg_dollar_boot_path()); + const char *path = arg_dollar_boot_path(); + if (!path) + return log_error_errno(SYNTHETIC_ERRNO(EACCES), "Failed to determine XBOOTLDR location: %m"); + + puts(path); } if (arg_print_esp_path || arg_print_dollar_boot_path)