summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-24 02:10:32 +0200
committerLennart Poettering <lennart@poettering.net>2015-07-24 02:10:32 +0200
commit02ab86c732576a71179ce12e97d44c289833236d (patch)
treed0eabda005661cfee6cd6d668a01119fdc40edfb
parentbca9e39dfadaefc4b02c0dd378adc3d6221071de (diff)
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.
-rw-r--r--src/journal/journalctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 2d6ecfb750..073cc77711 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();