]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: re-read object from cache
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Oct 2022 06:59:43 +0000 (15:59 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Oct 2022 10:32:59 +0000 (19:32 +0900)
Fixes a bug introduced by 0e35afff1db475b46281fac75fa3fc2d7f26cae7.

Replaces 3388a4b5820012b945d9925446764717afcdb5b0.

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

index 13f891a63350070cdbbdda3b655ba72072453094..ca5f5c9fccf144601bead3406402b9735f86f2c7 100644 (file)
@@ -4022,6 +4022,12 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
                         .object_offset = h,
                         .hash = le64toh(u->data.hash),
                 };
+
+                /* The above journal_file_data_payload() may clear or overwrite cached object. Hence, we need
+                 * to re-read the object from the cache. */
+                r = journal_file_move_to_object(from, OBJECT_ENTRY, p, &o);
+                if (r < 0)
+                        return r;
         }
 
         r = journal_file_append_entry_internal(to, &ts, boot_id, xor_hash, items, n, NULL, NULL, NULL);