diff --git a/src/journal/journalctl-show.c b/src/journal/journalctl-show.c index d4a7c730c5..eac93b222d 100644 --- a/src/journal/journalctl-show.c +++ b/src/journal/journalctl-show.c @@ -35,8 +35,8 @@ typedef struct Context { static void context_done(Context *c) { assert(c); - c->synchronize_varlink = sd_varlink_flush_close_unref(c->synchronize_varlink); - c->event = sd_event_unref(c->event); + sd_varlink_flush_close_unref(c->synchronize_varlink); + sd_event_unref(c->event); sd_journal_close(c->journal); } @@ -313,7 +313,7 @@ static int on_first_event(sd_event_source *s, void *userdata) { if (r < 0) return r; - if (arg_follow && !arg_reverse && !arg_cursor && !arg_after_cursor && !arg_cursor_file && !arg_since_set) { + if (arg_follow && !arg_reverse && !c->has_cursor && !arg_since_set) { r = sd_journal_get_cursor(c->journal, /* ret_cursor= */ NULL); if (r == -EADDRNOTAVAIL) { /* If we shall operate in --follow mode, and we are unable to get a cursor after @@ -350,8 +350,10 @@ static int on_synchronize_reply( assert(vl); - if (error_id) + if (error_id) { log_warning("Failed to synchronize on Journal, ignoring: %s", error_id); + (void) sd_notifyf(/* unset_environment= */ false, "VARLINKERROR=%s", error_id); + } r = show_and_fflush(c); if (r < 0) @@ -377,7 +379,7 @@ static int on_signal(sd_event_source *s, const struct signalfd_siginfo *si, void r = varlink_connect_journal(&vl); if (r < 0) { - log_error_errno(r, "Failed to connect to Journal Varlink IPC interface, ignoring: %m"); + log_error_errno(r, "Failed to connect to Journal Varlink IPC interface, skipping synchronization: %m"); goto finish; } diff --git a/src/journal/journald-sync.c b/src/journal/journald-sync.c index 657a493723..972f37bfc1 100644 --- a/src/journal/journald-sync.c +++ b/src/journal/journald-sync.c @@ -138,7 +138,7 @@ SyncReq* sync_req_free(SyncReq *req) { LIST_REMOVE(pending_rqlen, req->manager->sync_req_pending_rqlen, req); } - req->idle_event_source = sd_event_source_disable_unref(req->idle_event_source); + sd_event_source_disable_unref(req->idle_event_source); sd_varlink_unref(req->link); diff --git a/src/run/run.c b/src/run/run.c index 4005d26d45..876e436a5d 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -2438,7 +2438,7 @@ static int start_transient_service(sd_bus *bus) { _cleanup_(journal_terminate) PidRef journal_pid = PIDREF_NULL; if (arg_verbose) - (void) journal_fork(arg_runtime_scope, (const char**) STRV_MAKE(c.unit), &journal_pid); + (void) journal_fork(arg_runtime_scope, STRV_MAKE(c.unit), &journal_pid); r = bus_call_with_hint(bus, m, "service", &reply); if (r < 0) diff --git a/src/shared/fork-journal.c b/src/shared/fork-journal.c index ccefc74df0..883d9b5195 100644 --- a/src/shared/fork-journal.c +++ b/src/shared/fork-journal.c @@ -87,7 +87,7 @@ static int on_child_notify(sd_event_source *s, int fd, uint32_t revents, void *u return 0; } -int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidref) { +int journal_fork(RuntimeScope scope, char * const *units, PidRef *ret_pidref) { int r; assert(scope >= 0); @@ -97,7 +97,7 @@ int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidr if (!is_main_thread()) return -EPERM; - if (strv_isempty((char**) units)) + if (strv_isempty(units)) return 0; _cleanup_(sd_event_unrefp) sd_event *event = NULL; @@ -162,7 +162,7 @@ int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidr _exit(EXIT_MEMORY); } - r = invoke_callout_binary(argv[0], (char**) argv); + r = invoke_callout_binary(argv[0], argv); log_debug_errno(r, "Failed to invoke journalctl: %m"); _exit(EXIT_EXEC); } diff --git a/src/shared/fork-journal.h b/src/shared/fork-journal.h index c7ff87b8f7..1825a7f5eb 100644 --- a/src/shared/fork-journal.h +++ b/src/shared/fork-journal.h @@ -6,6 +6,6 @@ #include "runtime-scope.h" #include "set.h" -int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidref); +int journal_fork(RuntimeScope scope, char * const *units, PidRef *ret_pidref); void journal_terminate(PidRef *pidref); diff --git a/src/systemctl/systemctl-start-unit.c b/src/systemctl/systemctl-start-unit.c index 7e81afae00..1cb2a6db46 100644 --- a/src/systemctl/systemctl-start-unit.c +++ b/src/systemctl/systemctl-start-unit.c @@ -394,7 +394,7 @@ int verb_start(int argc, char *argv[], void *userdata) { ret = enqueue_marked_jobs(bus, w); else { if (arg_verbose) - (void) journal_fork(arg_runtime_scope, (const char**) names, &journal_pid); + (void) journal_fork(arg_runtime_scope, names, &journal_pid); STRV_FOREACH(name, names) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;