log_error("Failed to iterate through journal: %s", strerror(-r));
goto finish;
}
+ if (r == 0)
+ break;
}
- if (r == 0)
- break;
-
if (arg_until_set && !arg_reverse) {
usec_t usec;
arg_catalog * OUTPUT_CATALOG;
r = output_journal(stdout, j, arg_output, 0, flags);
- if (r < 0 || ferror(stdout))
+ need_seek = true;
+ if (r == -EADDRNOTAVAIL)
+ break;
+ else if (r < 0 || ferror(stdout))
goto finish;
- need_seek = true;
n_shown++;
}
sd_journal_set_data_threshold(j, flags & OUTPUT_SHOW_ALL ? 0 : PRINT_THRESHOLD);
- SD_JOURNAL_FOREACH_DATA(j, data, length) {
+ JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
r = parse_field(data, length, "PRIORITY=", &priority, &priority_len);
if (r < 0)
return r;
}
+ if (r < 0)
+ return r;
+
if (!message)
return 0;
r = sd_journal_get_monotonic_usec(j, &t, &boot_id);
if (r < 0) {
- log_error("Failed to get monotonic: %s", strerror(-r));
+ log_error("Failed to get monotonic timestamp: %s", strerror(-r));
return r;
}
r = sd_journal_get_realtime_usec(j, &x);
if (r < 0) {
- log_error("Failed to get realtime: %s", strerror(-r));
+ log_error("Failed to get realtime timestamp: %s", strerror(-r));
return r;
}
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
- log_error("Failed to get realtime timestamp: %s", strerror(-r));
+ log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_ERR,
+ "Failed to get realtime timestamp: %s", strerror(-r));
return r;
}
format_timestamp(ts, sizeof(ts), realtime),
cursor);
- SD_JOURNAL_FOREACH_DATA(j, data, length) {
+ JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
const char *c;
int fieldlen;
c = memchr(data, '=', length);
}
}
+ if (r < 0)
+ return r;
+
if (flags & OUTPUT_CATALOG)
print_catalog(f, j);
(unsigned long long) monotonic,
sd_id128_to_string(boot_id, sid));
- SD_JOURNAL_FOREACH_DATA(j, data, length) {
+ JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
/* We already printed the boot id, from the data in
* the header, hence let's suppress it here */
fputc('\n', f);
}
+ if (r < 0)
+ return r;
+
fputc('\n', f);
return 0;
return -ENOMEM;
/* First round, iterate through the entry and count how often each field appears */
- SD_JOURNAL_FOREACH_DATA(j, data, length) {
+ JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
const char *eq;
char *n;
unsigned u;
}
}
+ if (r < 0)
+ return r;
+
separator = true;
do {
done = true;