From 02ab86c732576a71179ce12e97d44c289833236d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 Jul 2015 02:10:32 +0200 Subject: 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. --- src/journal/journalctl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/journal/journalctl.c') 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(); -- cgit v1.2.3-54-g00ecf