mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
sd-journal: verify monotonic timestamp before assigning result
Previously, ret_boot_id was assigned even when the function failed due to an invalid monotonic timestamp stored for a journal entry.
This commit is contained in:
@@ -2656,9 +2656,7 @@ _public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id12
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ret_boot_id)
|
||||
*ret_boot_id = o->entry.boot_id;
|
||||
else {
|
||||
if (!ret_boot_id) {
|
||||
sd_id128_t id;
|
||||
|
||||
r = sd_id128_get_boot(&id);
|
||||
@@ -2675,6 +2673,8 @@ _public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id12
|
||||
|
||||
if (ret)
|
||||
*ret = t;
|
||||
if (ret_boot_id)
|
||||
*ret_boot_id = o->entry.boot_id;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user