From: Yu Watanabe Date: Wed, 9 Oct 2024 00:22:07 +0000 (+0900) Subject: login: use event_reset_time_relative() at one more place X-Git-Tag: v257-rc1~269^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70eedbafd9621097ca54b70ac24b14e5e816d734;p=thirdparty%2Fsystemd.git login: use event_reset_time_relative() at one more place --- diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 04c09ba8ab8..b688eab0cde 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1970,23 +1970,13 @@ static int delay_shutdown_or_sleep( assert(m); assert(a); - if (m->inhibit_timeout_source) { - r = sd_event_source_set_time_relative(m->inhibit_timeout_source, m->inhibit_delay_max); - if (r < 0) - return log_error_errno(r, "sd_event_source_set_time_relative() failed: %m"); - - r = sd_event_source_set_enabled(m->inhibit_timeout_source, SD_EVENT_ONESHOT); - if (r < 0) - return log_error_errno(r, "sd_event_source_set_enabled() failed: %m"); - } else { - r = sd_event_add_time_relative( - m->event, - &m->inhibit_timeout_source, - CLOCK_MONOTONIC, m->inhibit_delay_max, 0, - manager_inhibit_timeout_handler, m); - if (r < 0) - return r; - } + r = event_reset_time_relative( + m->event, &m->inhibit_timeout_source, + CLOCK_MONOTONIC, m->inhibit_delay_max, /* accuracy = */ 0, + manager_inhibit_timeout_handler, m, + /* priority = */ 0, "inhibit-timeout", /* force = */ true); + if (r < 0) + return log_error_errno(r, "Failed to reset timer event source for inhibit timeout: %m"); m->delayed_action = a;