mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
journal: Fix journal dumping for json, cat and export output
Incorporating the fix from d00f1d57
into other output formats of journalctl.
If journal files are corrupted, e.g. not cleanly closed, some journal
entries can not be read by output options other than 'short' (default).
If such entries has been identified, they will now just be skipped.
This commit is contained in:
parent
204d140c4d
commit
4f5e172341
@ -661,6 +661,10 @@ static int output_export(
|
||||
|
||||
fputc('\n', f);
|
||||
}
|
||||
if (r == -EBADMSG) {
|
||||
log_debug_errno(r, "Skipping message we can't read: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -824,6 +828,11 @@ static int output_json(
|
||||
}
|
||||
}
|
||||
|
||||
if (r == -EBADMSG) {
|
||||
log_debug_errno(r, "Skipping message we can't read: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -964,6 +973,10 @@ static int output_cat(
|
||||
sd_journal_set_data_threshold(j, 0);
|
||||
|
||||
r = sd_journal_get_data(j, "MESSAGE", &data, &l);
|
||||
if (r == -EBADMSG) {
|
||||
log_debug_errno(r, "Skipping message we can't read: %m");
|
||||
return 0;
|
||||
}
|
||||
if (r < 0) {
|
||||
/* An entry without MESSAGE=? */
|
||||
if (r == -ENOENT)
|
||||
|
Loading…
Reference in New Issue
Block a user