From: Lennart Poettering Date: Fri, 24 Jul 2015 00:10:32 +0000 (+0200) Subject: journalctl: properly detect empty journal files X-Git-Tag: v223~44^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=02ab86c732576a71179ce12e97d44c289833236d;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 2d6ecfb7508..073cc777113 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();