sd-journal: add missing 'error' handling

When we reach an empty array, there are at least two possibilities:
- journal file is corrupted,
- invalid index is requested.

We cannot distinguish them here, let's simply return earlier.
This commit is contained in:
Yu Watanabe
2023-09-30 20:10:15 +09:00
parent fe6f2bd8a6
commit f85e79d3e5
+3
View File
@@ -2788,6 +2788,9 @@ static int generic_array_get(
return r;
k = journal_file_entry_array_n_items(f, o);
if (k == 0)
return 0;
if (i < k)
break;