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.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user