anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

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

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