mirror of
https://github.com/systemd/systemd
synced 2024-10-01 13:55:20 +00:00
various: remove unnecessary check before sd_event_source_set_enabled()
sd_event_source_set_enabled() does the same check internally.
This commit is contained in:
parent
acddb3cb79
commit
a3ada90a37
|
@ -734,9 +734,6 @@ static int automount_start_expire(Automount *a) {
|
|||
static void automount_stop_expire(Automount *a) {
|
||||
assert(a);
|
||||
|
||||
if (!a->expire_event_source)
|
||||
return;
|
||||
|
||||
(void) sd_event_source_set_enabled(a->expire_event_source, SD_EVENT_OFF);
|
||||
}
|
||||
|
||||
|
|
|
@ -1734,9 +1734,6 @@ static void socket_unwatch_fds(Socket *s) {
|
|||
if (p->fd < 0)
|
||||
continue;
|
||||
|
||||
if (!p->event_source)
|
||||
continue;
|
||||
|
||||
r = sd_event_source_set_enabled(p->event_source, SD_EVENT_OFF);
|
||||
if (r < 0)
|
||||
log_unit_debug_errno(UNIT(s), r, "Failed to disable event source: %m");
|
||||
|
|
|
@ -514,7 +514,6 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
|
|||
goto fail;
|
||||
}
|
||||
} else {
|
||||
|
||||
r = sd_event_add_time(
|
||||
UNIT(t)->manager->event,
|
||||
&t->monotonic_event_source,
|
||||
|
@ -529,8 +528,7 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
|
|||
(void) sd_event_source_set_description(t->monotonic_event_source, "timer-monotonic");
|
||||
}
|
||||
|
||||
} else if (t->monotonic_event_source) {
|
||||
|
||||
} else {
|
||||
r = sd_event_source_set_enabled(t->monotonic_event_source, SD_EVENT_OFF);
|
||||
if (r < 0) {
|
||||
log_unit_warning_errno(UNIT(t), r, "Failed to disable monotonic event source: %m");
|
||||
|
|
|
@ -142,10 +142,8 @@ static int curl_glue_timer_callback(CURLM *curl, long timeout_ms, void *userdata
|
|||
}
|
||||
|
||||
if (timeout_ms < 0) {
|
||||
if (g->timer) {
|
||||
if (sd_event_source_set_enabled(g->timer, SD_EVENT_OFF) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -784,12 +784,10 @@ static void server_sync(Server *s, bool wait) {
|
|||
"Failed to sync user journal, ignoring: %m");
|
||||
}
|
||||
|
||||
if (s->sync_event_source) {
|
||||
r = sd_event_source_set_enabled(s->sync_event_source, SD_EVENT_OFF);
|
||||
if (r < 0)
|
||||
log_ratelimit_error_errno(r, JOURNAL_LOG_RATELIMIT,
|
||||
"Failed to disable sync timer source: %m");
|
||||
}
|
||||
log_ratelimit_warning_errno(r, JOURNAL_LOG_RATELIMIT,
|
||||
"Failed to disable sync timer source, ignoring: %m");
|
||||
|
||||
s->sync_scheduled = false;
|
||||
}
|
||||
|
|
|
@ -472,11 +472,9 @@ static int add_connection_socket(Context *context, int fd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (context->idle_time) {
|
||||
r = sd_event_source_set_enabled(context->idle_time, SD_EVENT_OFF);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Unable to disable idle timer, continuing: %m");
|
||||
}
|
||||
|
||||
c = new(Connection, 1);
|
||||
if (!c) {
|
||||
|
|
Loading…
Reference in a new issue