sd-event: emit a debug line if disabling unreffed source fails
We can only do a debug log from the library, so let's add that. Callers probably want to provide some hint when that happens, but it's very unlikely so not worth coding in every caller. And drop the now-unnecessary handling in unit_dequeue_rewatch_pids().
This commit is contained in:
@@ -2978,16 +2978,8 @@ int unit_enqueue_rewatch_pids(Unit *u) {
|
||||
}
|
||||
|
||||
void unit_dequeue_rewatch_pids(Unit *u) {
|
||||
int r;
|
||||
assert(u);
|
||||
|
||||
if (!u->rewatch_pids_event_source)
|
||||
return;
|
||||
|
||||
r = sd_event_source_set_enabled(u->rewatch_pids_event_source, SD_EVENT_OFF);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to disable event source for tidying watched PIDs, ignoring: %m");
|
||||
|
||||
u->rewatch_pids_event_source = sd_event_source_disable_unref(u->rewatch_pids_event_source);
|
||||
}
|
||||
|
||||
|
||||
@@ -474,8 +474,13 @@ _public_ sd_event* sd_event_unref(sd_event *e) {
|
||||
_unused_ _cleanup_(sd_event_unrefp) sd_event *_ref = sd_event_ref(e);
|
||||
|
||||
_public_ sd_event_source* sd_event_source_disable_unref(sd_event_source *s) {
|
||||
if (s)
|
||||
(void) sd_event_source_set_enabled(s, SD_EVENT_OFF);
|
||||
int r;
|
||||
|
||||
r = sd_event_source_set_enabled(s, SD_EVENT_OFF);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to disable event source %p (%s): %m",
|
||||
s, strna(s->description));
|
||||
|
||||
return sd_event_source_unref(s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user