mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-24 18:56:59 +07:00
journal: count number of entry arrays in header
This commit is contained in:
parent
45b51b6b71
commit
2dee23ebe0
@ -185,6 +185,7 @@ _packed_ struct Header {
|
||||
le64_t n_fields;
|
||||
/* Added in 189 */
|
||||
le64_t n_tags;
|
||||
le64_t n_entry_arrays;
|
||||
};
|
||||
|
||||
#define FSPRG_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
|
||||
|
@ -839,6 +839,9 @@ static int link_entry_into_array(JournalFile *f,
|
||||
o->entry_array.next_entry_array_offset = htole64(q);
|
||||
}
|
||||
|
||||
if (JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays))
|
||||
f->header->n_entry_arrays = htole64(le64toh(f->header->n_entry_arrays) + 1);
|
||||
|
||||
*idx = htole64(hidx + 1);
|
||||
|
||||
return 0;
|
||||
|
@ -837,6 +837,13 @@ int journal_file_verify(JournalFile *f, const char *key) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays) &&
|
||||
n_entry_arrays != le64toh(f->header->n_entry_arrays)) {
|
||||
log_error("Entry array number mismatch");
|
||||
r = -EBADMSG;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (n_data_hash_tables != 1) {
|
||||
log_error("Missing data hash table");
|
||||
r = -EBADMSG;
|
||||
|
Loading…
Reference in New Issue
Block a user