X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fsd-journal.c;h=3740a9a84035c1c5926371a3c503f27936d415dc;hb=0a1b6da82109c3b08b1f966a1625a77cc312135a;hp=fa2009c5dc5c256e161988664ef27f7f962d0865;hpb=39883f622f392d8579f4428fc5a789a102efbb10;p=elogind.git diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index fa2009c5d..3740a9a84 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -871,9 +871,9 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc static int real_journal_next(sd_journal *j, direction_t direction) { JournalFile *f, *new_file = NULL; uint64_t new_offset = 0; - Object *o; - uint64_t p; + uint64_t p = 0; Iterator i; + Object *o; int r; assert_return(j, -EINVAL); @@ -2347,6 +2347,7 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from, Iterator i; JournalFile *f; bool first = true; + uint64_t fmin = 0, tmax = 0; int r; assert_return(j, -EINVAL); @@ -2366,19 +2367,20 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from, continue; if (first) { - if (from) - *from = fr; - if (to) - *to = t; + fmin = fr; + tmax = t; first = false; } else { - if (from) - *from = MIN(fr, *from); - if (to) - *to = MAX(t, *to); + fmin = MIN(fr, fmin); + tmax = MAX(t, tmax); } } + if (from) + *from = fmin; + if (to) + *to = tmax; + return first ? 0 : 1; }