Blame SOURCES/0280-journalctl-show-friendly-info-when-using-b-on-runtim.patch

17b0f1
From a932c70a76846aa7dbb4b783291b44bfc8cbd76c Mon Sep 17 00:00:00 2001
17b0f1
From: Jan Synacek <jsynacek@redhat.com>
17b0f1
Date: Mon, 1 Feb 2016 09:25:22 +0100
17b0f1
Subject: [PATCH] journalctl: show friendly info when using -b on runtime
17b0f1
 journal only
17b0f1
17b0f1
Make it clear that specifing boot when there is actually only one has no
17b0f1
effect. This cosmetic patch improves user experience a bit.
17b0f1
17b0f1
Cherry-picked from: 0f1a9a830c87d8accdc3a44d0a93ad343e52a7bd
17b0f1
Resolves: #1082179
17b0f1
---
17b0f1
 src/journal/journalctl.c | 7 +++++++
17b0f1
 1 file changed, 7 insertions(+)
17b0f1
17b0f1
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
17b0f1
index 964f849ee0..836d7d2141 100644
17b0f1
--- a/src/journal/journalctl.c
17b0f1
+++ b/src/journal/journalctl.c
17b0f1
@@ -1905,6 +1905,13 @@ int main(int argc, char *argv[]) {
17b0f1
                 goto finish;
17b0f1
         }
17b0f1
 
17b0f1
+        if (arg_boot_offset != 0 &&
17b0f1
+            sd_journal_has_runtime_files(j) > 0 &&
17b0f1
+            sd_journal_has_persistent_files(j) == 0) {
17b0f1
+                log_info("Specifying boot ID has no effect, no persistent journal was found");
17b0f1
+                r = 0;
17b0f1
+                goto finish;
17b0f1
+        }
17b0f1
         /* add_boot() must be called first!
17b0f1
          * It may need to seek the journal to find parent boot IDs. */
17b0f1
         r = add_boot(j);