From f40999f87803cf456094ba42ca5f83d7bee059c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 5 Mar 2019 13:56:18 +0100 Subject: [PATCH] shared/bootspec: minor simplification --- src/shared/bootspec.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 39a7a97b12..59447d03b4 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -694,17 +694,12 @@ int boot_entries_load_config_auto( * want to. */ if (!override_esp_path && !override_xbootldr_path) { + if (access("/run/boot-loader-entries/", F_OK) >= 0) + return boot_entries_load_config("/run/boot-loader-entries/", NULL, config); - if (access("/run/boot-loader-entries/", F_OK) < 0) { - if (errno != ENOENT) - return log_error_errno(errno, "Failed to determine whether /run/boot-loader-entries/ exists: %m"); - } else { - r = boot_entries_load_config("/run/boot-loader-entries/", NULL, config); - if (r < 0) - return r; - - return 0; - } + if (errno != ENOENT) + return log_error_errno(errno, + "Failed to determine whether /run/boot-loader-entries/ exists: %m"); } r = find_esp_and_warn(override_esp_path, false, &esp_where, NULL, NULL, NULL, NULL); @@ -717,11 +712,7 @@ int boot_entries_load_config_auto( if (r < 0 && r != -ENOKEY) return r; /* It's fine if the XBOOTLDR partition doesn't exist, hence we ignore ENOKEY here */ - r = boot_entries_load_config(esp_where, xbootldr_where, config); - if (r < 0) - return r; - - return 0; + return boot_entries_load_config(esp_where, xbootldr_where, config); } int boot_entries_augment_from_loader(BootConfig *config, bool only_auto) { -- 2.25.1