34 lines
1.0 KiB
Diff
34 lines
1.0 KiB
Diff
|
From c6ab40306733c31e5f2f2d56b3fb199e6b4bfda2 Mon Sep 17 00:00:00 2001
|
||
|
From: Lennart Poettering <lennart@poettering.net>
|
||
|
Date: Fri, 24 Jul 2015 02:10:32 +0200
|
||
|
Subject: [PATCH 05/12] journalctl: properly detect empty journal files
|
||
|
|
||
|
When we encounter a journal file with exactly zero entries, print a nice
|
||
|
message and exit, and don't print a weird error message.
|
||
|
|
||
|
(cherry picked from commit 02ab86c732576a71179ce12e97d44c289833236d)
|
||
|
|
||
|
Resolves: #1255619
|
||
|
---
|
||
|
src/journal/journalctl.c | 4 ++++
|
||
|
1 file changed, 4 insertions(+)
|
||
|
|
||
|
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
|
||
|
index 2d6ecfb..073cc77 100644
|
||
|
--- a/src/journal/journalctl.c
|
||
|
+++ b/src/journal/journalctl.c
|
||
|
@@ -2066,6 +2066,10 @@ int main(int argc, char *argv[]) {
|
||
|
log_error_errno(r, "Failed to iterate through journal: %m");
|
||
|
goto finish;
|
||
|
}
|
||
|
+ if (r == 0) {
|
||
|
+ printf("-- No entries --\n");
|
||
|
+ goto finish;
|
||
|
+ }
|
||
|
|
||
|
if (!arg_follow)
|
||
|
pager_open_if_enabled();
|
||
|
--
|
||
|
2.5.0
|
||
|
|