summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/journal/sd-journal.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index f674abf9d7..6349aeb785 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2399,7 +2399,7 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
Iterator i;
JournalFile *f;
- bool first = true;
+ bool found = false;
int r;
assert_return(j, -EINVAL);
@@ -2418,21 +2418,21 @@ _public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
if (r == 0)
continue;
- if (first) {
+ if (found) {
if (from)
- *from = fr;
+ *from = MIN(fr, *from);
if (to)
- *to = t;
- first = false;
+ *to = MAX(t, *to);
} else {
if (from)
- *from = MIN(fr, *from);
+ *from = fr;
if (to)
- *to = MAX(t, *to);
+ *to = t;
+ found = true;
}
}
- return first ? 0 : 1;
+ return found;
}
void journal_print_header(sd_journal *j) {