summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-25 21:43:12 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-26 12:00:03 +0200
commitd00f1d57cc326231e7003340056f4fbcf056674c (patch)
treefd7f5be33174370fd3d46ff14cb49302d8838021
parent50809d7a9c986f78d8b8872098e4880aa8ff2076 (diff)
journal: when dumping journal contents, react nicer to lines we can't read
If journal files are not cleanly closed it might happen that intermediaery journal entries cannot be read. Handle this nicely, skip over the unreadable entries, and log a debug message about it; after all we generally follow the logic that we try to make the best of corrupted files.
-rw-r--r--src/shared/logs-show.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index cd3d53669c..9351b85eed 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -287,7 +287,10 @@ static int output_short(
if (r < 0)
return r;
}
-
+ if (r == -EBADMSG) {
+ log_debug_errno(r, "Skipping message we can't read: %m");
+ return 0;
+ }
if (r < 0)
return log_error_errno(r, "Failed to get journal fields: %m");