]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: don't trip up in "bootctl status" when we can't find the ESP because of...
authorLennart Poettering <lennart@poettering.net>
Mon, 11 Dec 2017 21:15:03 +0000 (22:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 11 Dec 2017 22:18:56 +0000 (23:18 +0100)
On my system the boot and EFI partitions are protected, hence "bootctl
status" can't find the ESP, and then the tool continues with arg_path ==
NULL, which it really should not. Handle these cases, and simply
suppress all output that needs arg_path.

src/boot/bootctl.c

index 52207661cf61f7b92618b92d4d0c7ccf901adb2d..a5700992d4dd0d838dfce79d7be920c8f2778dc7 100644 (file)
@@ -999,9 +999,11 @@ static int verb_status(int argc, char *argv[], void *userdata) {
         } else
                 printf("System:\n    Not booted with EFI\n\n");
 
-        k = status_binaries(arg_path, uuid);
-        if (k < 0)
-                r = k;
+        if (arg_path) {
+                k = status_binaries(arg_path, uuid);
+                if (k < 0)
+                        r = k;
+        }
 
         if (is_efi_boot()) {
                 k = status_variables();
@@ -1009,9 +1011,11 @@ static int verb_status(int argc, char *argv[], void *userdata) {
                         r = k;
         }
 
-        k = status_entries(arg_path, uuid);
-        if (k < 0)
-                r = k;
+        if (arg_path) {
+                k = status_entries(arg_path, uuid);
+                if (k < 0)
+                        r = k;
+        }
 
         return r;
 }