From 2a7b539a82a45202c0e990c45da25ccdc487d633 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 24 Sep 2012 15:02:43 +0200 Subject: [PATCH] journald: always pass first entry timestamp back from journal_file_verify() --- src/journal/journal-verify.c | 6 +++--- src/journal/journal-verify.h | 2 +- src/journal/journalctl.c | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c index 629b2389b..7d2e5eb1c 100644 --- a/src/journal/journal-verify.c +++ b/src/journal/journal-verify.c @@ -666,7 +666,7 @@ static int verify_entry_array( int journal_file_verify( JournalFile *f, const char *key, - usec_t *first_validated, usec_t *last_validated, usec_t *last_contained, + usec_t *first_contained, usec_t *last_validated, usec_t *last_contained, bool show_progress) { int r; Object *o; @@ -1121,8 +1121,8 @@ int journal_file_verify( close_nointr_nofail(entry_fd); close_nointr_nofail(entry_array_fd); - if (first_validated) - *first_validated = last_sealed_realtime > 0 ? le64toh(f->header->head_entry_realtime) : 0; + if (first_contained) + *first_contained = le64toh(f->header->head_entry_realtime); if (last_validated) *last_validated = last_sealed_realtime; if (last_contained) diff --git a/src/journal/journal-verify.h b/src/journal/journal-verify.h index a4633adea..e392ab61d 100644 --- a/src/journal/journal-verify.h +++ b/src/journal/journal-verify.h @@ -23,4 +23,4 @@ #include "journal-file.h" -int journal_file_verify(JournalFile *f, const char *key, usec_t *first_validated, usec_t *last_validated, usec_t *last_contained, bool show_progress); +int journal_file_verify(JournalFile *f, const char *key, usec_t *first_contained, usec_t *last_validated, usec_t *last_contained, bool show_progress); diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index b9be0c6ef..62bdcb7c6 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -684,14 +684,14 @@ static int verify(sd_journal *j) { HASHMAP_FOREACH(f, j->files, i) { int k; - usec_t from, to, total; + usec_t first, validated, last; #ifdef HAVE_GCRYPT if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) log_notice("Journal file %s has sealing enabled but verification key has not been passed using --verify-key=.", f->path); #endif - k = journal_file_verify(f, arg_verify_key, &from, &to, &total, true); + k = journal_file_verify(f, arg_verify_key, &first, &validated, &last, true); if (k == -EINVAL) { /* If the key was invalid give up right-away. */ return k; @@ -703,14 +703,14 @@ static int verify(sd_journal *j) { log_info("PASS: %s", f->path); if (arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) { - if (from > 0) { + if (validated > 0) { log_info("=> Validated from %s to %s, final %s entries not sealed.", - format_timestamp(a, sizeof(a), from), - format_timestamp(b, sizeof(b), to), - format_timespan(c, sizeof(c), total > to ? total - to : 0)); - } else if (total > 0) + format_timestamp(a, sizeof(a), first), + format_timestamp(b, sizeof(b), validated), + format_timespan(c, sizeof(c), last > validated ? last - validated : 0)); + } else if (last > 0) log_info("=> No sealing yet, %s of entries not sealed.", - format_timespan(c, sizeof(c), total - f->header->head_entry_realtime)); + format_timespan(c, sizeof(c), last - first)); else log_info("=> No sealing yet, no entries in file."); } -- 2.30.2