diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-08-16 20:51:24 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-08-16 21:00:47 +0200 |
commit | 2dee23ebe09965308c67a661ed0a8d2cc0ae1d5f (patch) | |
tree | a204a3ffb3f2f135d1d37280479cdf241e348f5f /src | |
parent | 45b51b6b71c9de2067dc42c689879bb051517ccb (diff) |
journal: count number of entry arrays in header
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journal-def.h | 1 | ||||
-rw-r--r-- | src/journal/journal-file.c | 3 | ||||
-rw-r--r-- | src/journal/journal-verify.c | 7 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h index e61e81ca84..660a92c147 100644 --- a/src/journal/journal-def.h +++ b/src/journal/journal-def.h @@ -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' }) diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index e0b20ccefd..81952a08ee 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -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; diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c index 55ca52a641..b4e34d18a8 100644 --- a/src/journal/journal-verify.c +++ b/src/journal/journal-verify.c @@ -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; |