switch(u->entry_state) {
case ENTRY_CURSOR: {
- free(u->last_cursor);
- u->last_cursor = NULL;
+ free(u->current_cursor);
+ u->current_cursor = NULL;
- r = sd_journal_get_cursor(u->journal, &u->last_cursor);
+ r = sd_journal_get_cursor(u->journal, &u->current_cursor);
if (r < 0) {
- log_error("Failed to get cursor: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get cursor: %m");
return r;
}
r = snprintf(buf + pos, size - pos,
- "__CURSOR=%s\n", u->last_cursor);
+ "__CURSOR=%s\n", u->current_cursor);
if (pos + r > size)
/* not enough space */
return pos;
r = sd_journal_get_realtime_usec(u->journal, &realtime);
if (r < 0) {
- log_error("Failed to get realtime timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get realtime timestamp: %m");
return r;
}
r = sd_journal_get_monotonic_usec(u->journal, &monotonic, &boot_id);
if (r < 0) {
- log_error("Failed to get monotonic timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get monotonic timestamp: %m");
return r;
}
r = sd_journal_get_monotonic_usec(u->journal, NULL, &boot_id);
if (r < 0) {
- log_error("Failed to get monotonic timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get monotonic timestamp: %m");
return r;
}
break;
log_debug("Entry %zu (%s) has been uploaded.",
- u->entries_sent, u->last_cursor);
+ u->entries_sent, u->current_cursor);
}
return filled;
r = sd_journal_next_skip(u->journal, skip);
if (r < 0) {
- log_error("Failed to skip to next entry: %s", strerror(-r));
+ log_error_errno(-r, "Failed to skip to next entry: %m");
return r;
} else if (r < skip)
return 0;
r = sd_journal_process(u->journal);
if (r < 0) {
- log_error("Failed to process journal: %s", strerror(-r));
+ log_error_errno(-r, "Failed to process journal: %m");
close_journal_input(u);
return r;
}
if (follow) {
fd = sd_journal_get_fd(j);
if (fd < 0) {
- log_error("sd_journal_get_fd failed: %s", strerror(-fd));
+ log_error_errno(-fd, "sd_journal_get_fd failed: %m");
return fd;
}
r = sd_event_add_io(u->events, &u->input_event,
fd, events, dispatch_journal_input, u);
if (r < 0) {
- log_error("Failed to register input event: %s", strerror(-r));
+ log_error_errno(-r, "Failed to register input event: %m");
return r;
}