richardphibel / rpms / systemd

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