]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logs-show: Always retrieve the boot ID from the entry
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 11 Oct 2022 11:26:41 +0000 (13:26 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Oct 2022 13:25:12 +0000 (15:25 +0200)
If _SOURCE_MONOTONIC_TIMESTAMP was set in the entry, we wouldn't
query the boot ID, leading to every kernel entry in the export mode
to have BOOT_ID=000000000000000. Let's fix this by always querying
the boot ID.

src/shared/logs-show.c

index 0ebc66597d0990123fc173b67aa69650be1f7eff..046ba4ba24660cf35b89835981a099d078dbf556 100644 (file)
@@ -1289,8 +1289,10 @@ static int get_dual_timestamp(sd_journal *j, dual_timestamp *ret_ts, sd_id128_t
 
         if (monotonic)
                 r = safe_atou64(monotonic, &ret_ts->monotonic);
-        if (!monotonic || r < 0 || !VALID_MONOTONIC(ret_ts->monotonic))
-                r = sd_journal_get_monotonic_usec(j, &ret_ts->monotonic, ret_boot_id);
+        r = sd_journal_get_monotonic_usec(
+                        j,
+                        !monotonic || r < 0 || !VALID_MONOTONIC(ret_ts->monotonic) ? &ret_ts->monotonic : NULL,
+                        ret_boot_id);
         if (r < 0)
                 ret_ts->monotonic = USEC_INFINITY;