]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: fail and show error message when no boot ID found
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 25 Apr 2024 05:22:41 +0000 (14:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2024 02:43:57 +0000 (11:43 +0900)
No boot ID in journal should be definitly spurious.
Let's warn about that and exit with failure.

src/journal/journalctl-misc.c

index 47eb72575ab92e86d9bbeab1a174d8a848535f82..65785d4d357b4821c13152ae9056bb36a64d6afb 100644 (file)
@@ -115,7 +115,8 @@ int action_list_boots(void) {
         if (r < 0)
                 return log_error_errno(r, "Failed to determine boots: %m");
         if (r == 0)
-                return 0;
+                return log_full_errno(arg_quiet ? LOG_DEBUG : LOG_ERR, SYNTHETIC_ERRNO(ENODATA),
+                                      "No boot found.");
 
         table = table_new("idx", "boot id", "first entry", "last entry");
         if (!table)