]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logs-show: fix stored timestamp when advance_older is true
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 26 Apr 2024 02:30:34 +0000 (11:30 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2024 02:43:57 +0000 (11:43 +0900)
Currently, the parsed timestamp is only used when advance_older is
false. Hence, this does not change any behavior. But, let's fix it anyway.

src/shared/logs-show.c

index 069fcde4bfe93a6b3554b2a387c6fc21f6fecb0a..9851fd3646f665e34e83882eddde6d5542a9ff0f 100644 (file)
@@ -1841,7 +1841,7 @@ static int discover_next_boot(
                         goto try_again;
                 }
 
-                r = sd_journal_get_realtime_usec(j, &boot.first_usec);
+                r = sd_journal_get_realtime_usec(j, advance_older ? &boot.last_usec : &boot.first_usec);
                 if (r < 0)
                         return r;
 
@@ -1863,7 +1863,7 @@ static int discover_next_boot(
                         goto try_again;
                 }
 
-                r = sd_journal_get_realtime_usec(j, &boot.last_usec);
+                r = sd_journal_get_realtime_usec(j, advance_older ? &boot.first_usec : &boot.last_usec);
                 if (r < 0)
                         return r;