]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: fix check in `journal_file_verify_header()`
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Fri, 5 Apr 2024 06:27:36 +0000 (08:27 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 5 Apr 2024 11:03:19 +0000 (13:03 +0200)
Fixes 6ea51363c8e39fb0924dda972a212936456a2b4f

src/libsystemd/sd-journal/journal-file.c

index 11461ee06081cfdc316287a684fd816564a5a664..c6652f2359563eeaff6395c37bf38f4a35e5447e 100644 (file)
@@ -638,7 +638,7 @@ static int journal_file_verify_header(JournalFile *f) {
                                 return -ENODATA;
                         if (!VALID_REALTIME(le64toh(f->header->tail_entry_realtime)))
                                 return -ENODATA;
-                        if (!VALID_MONOTONIC(le64toh(f->header->tail_entry_realtime)))
+                        if (!VALID_MONOTONIC(le64toh(f->header->tail_entry_monotonic)))
                                 return -ENODATA;
                 } else {
                         /* Otherwise, the fields must be zero. */
@@ -649,7 +649,7 @@ static int journal_file_verify_header(JournalFile *f) {
                                 return -ENODATA;
                         if (f->header->tail_entry_realtime != 0)
                                 return -ENODATA;
-                        if (f->header->tail_entry_realtime != 0)
+                        if (f->header->tail_entry_monotonic != 0)
                                 return -ENODATA;
                 }
         }
@@ -2531,7 +2531,7 @@ int journal_file_append_entry(
                                                ts->realtime);
                 if (!VALID_MONOTONIC(ts->monotonic))
                         return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
-                                               "Invalid monotomic timestamp %" PRIu64 ", refusing entry.",
+                                               "Invalid monotonic timestamp %" PRIu64 ", refusing entry.",
                                                ts->monotonic);
         } else {
                 dual_timestamp_now(&_ts);