naccyde / rpms / systemd

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