From 1651e2c61e544de9ca947c8b3202552b1272ef57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 18 Jul 2014 21:44:36 -0400 Subject: man,journal: add note about sd_journal_get_cutoff_monotonic_usec return value Also modify the function itself to be a bit simpler to read. --- src/journal/sd-journal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/journal') diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index f674abf9d..6349aeb78 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) { -- cgit v1.2.3