summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-18 21:44:36 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-18 21:44:36 -0400
commit1651e2c61e544de9ca947c8b3202552b1272ef57 (patch)
tree5e8c25a76fab1f188042b2898605dfc9ae436c85 /src/journal
parent01c3322e017989d25f7b4b51268245d5315ae678 (diff)
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.
Diffstat (limited to 'src/journal')
-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) {