chiark / gitweb /
man: document systemd-journalctl(1)
[elogind.git] / src / journal / sd-journal.c
index 5e1fd4773e835d1534e54765bbeedab06df41940..86ac267de406550074dd5065269586f19ea86dfc 100644 (file)
@@ -66,7 +66,7 @@ static void init_location(Location *l, JournalFile *f, Object *o) {
         l->seqnum_id = f->header->seqnum_id;
         l->realtime = le64toh(o->entry.realtime);
         l->monotonic = le64toh(o->entry.monotonic);
-        l->boot_id = le64toh(o->entry.boot_id);
+        l->boot_id = o->entry.boot_id;
         l->xor_hash = le64toh(o->entry.xor_hash);
 
         l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true;
@@ -527,6 +527,9 @@ static int next_with_matches(sd_journal *j, JournalFile *f, direction_t directio
                          * matches are not OK */
 
                         r = journal_file_next_entry_for_data(f, c, cp, le64toh(c->entry.items[k].object_offset), direction, &qo, &q);
+                        /* This pointer is invalidated if the window was
+                         * remapped. May need to re-fetch it later */
+                        c = NULL;
                         if (r < 0)
                                 return r;
 
@@ -552,8 +555,15 @@ static int next_with_matches(sd_journal *j, JournalFile *f, direction_t directio
 
                 /* Did this entry match against all matches? */
                 if (found) {
-                        if (ret)
+                        if (ret) {
+                                if (c == NULL) {
+                                        /* Re-fetch the entry */
+                                        r = journal_file_move_to_object(f, OBJECT_ENTRY, cp, &c);
+                                        if (r < 0)
+                                                return r;
+                                }
                                 *ret = c;
+                        }
                         if (offset)
                                 *offset = cp;
                         return 1;