]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: also print efi files not owned by systemd in status 27856/head
authorArian van Putten <arian.vanputten@gmail.com>
Wed, 31 May 2023 11:27:13 +0000 (13:27 +0200)
committerArian van Putten <arian.vanputten@gmail.com>
Wed, 31 May 2023 12:30:31 +0000 (14:30 +0200)
We should not skip over unknown entries in EFI/BOOT/ but
also print them out in status so people are aware that they are there.

src/boot/bootctl-status.c

index 0e4e87ae24106978f3d6053b6567ad712f45dfe8..3e9baea4d9d529135130629b47cd220368d6279b 100644 (file)
@@ -226,9 +226,8 @@ static int enumerate_binaries(
                         return log_error_errno(errno, "Failed to open file for reading: %m");
 
                 r = get_file_version(fd, &v);
-                if (r == -ESRCH) /* Not the file we are looking for. */
-                        continue;
-                if (r < 0)
+
+                if (r < 0 && r != -ESRCH)
                         return r;
 
                 if (*previous) { /* Let's output the previous entry now, since now we know that there will be
@@ -243,7 +242,10 @@ static int enumerate_binaries(
                 /* Do not output this entry immediately, but store what should be printed in a state
                  * variable, because we only will know the tree glyph to print (branch or final edge) once we
                  * read one more entry */
-                r = asprintf(previous, "/%s/%s (%s%s%s)", path, de->d_name, ansi_highlight(), v, ansi_normal());
+                if (r == -ESRCH) /* No systemd-owned file but still interesting to print */
+                        r = asprintf(previous, "/%s/%s", path, de->d_name);
+                else /* if (r >= 0) */
+                        r = asprintf(previous, "/%s/%s (%s%s%s)", path, de->d_name, ansi_highlight(), v, ansi_normal());
                 if (r < 0)
                         return log_oom();