From 5da5d848f9d5175998e8a1030d32a7edb3371956 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 25 Apr 2024 14:22:41 +0900 Subject: [PATCH] journalctl: fail and show error message when no boot ID found No boot ID in journal should be definitly spurious. Let's warn about that and exit with failure. --- src/journal/journalctl-misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/journal/journalctl-misc.c b/src/journal/journalctl-misc.c index 47eb72575a..65785d4d35 100644 --- a/src/journal/journalctl-misc.c +++ b/src/journal/journalctl-misc.c @@ -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)