sd-journal: ignore failure in testing cached corrupted entry

Let's consider the case that the 1st entry in an array is broken, but
n-th entry is valid. Then, if generic_array_get() is called to read
n-th object, the offset of the broken entry is cached by the function.
If generic_array_bisect() is followed, even if the matching entry is
valid, it always fail with -EBADMSG or friends, as the function test the
cached entry at the beginnning. Let's ignore the failure in testing the
cached entry.
This commit is contained in:
Yu Watanabe
2023-12-01 09:27:38 +09:00
parent d4506301f9
commit 5dca908a9a
+4 -3
View File
@@ -3006,10 +3006,11 @@ static int generic_array_bisect(
* check that first. */
r = test_object(f, ci->begin, needle);
if (r < 0)
if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL))
log_debug_errno(r, "Cached entry is corrupted, ignoring: %m");
else if (r < 0)
return r;
if (r == TEST_LEFT) {
else if (r == TEST_LEFT) {
/* OK, what we are looking for is right of the begin of this EntryArray, so let's
* jump straight to previously cached array in the chain */