]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: when dumping journal contents, react nicer to lines we can't read
authorLennart Poettering <lennart@poettering.net>
Mon, 25 Apr 2016 19:43:12 +0000 (21:43 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Apr 2016 10:00:03 +0000 (12:00 +0200)
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.

src/shared/logs-show.c

index cd3d53669ca8b6412443f05d67af2aa34dac4824..9351b85eed8e1205da445ea36d753691a9545f93 100644 (file)
@@ -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");