From: Yu Watanabe Date: Wed, 9 Oct 2024 01:07:31 +0000 (+0900) Subject: login: provide delayed action in ScheduledShutdown property X-Git-Tag: v257-rc1~269^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4b138548f33d03b7074753a84953060f9f81763;p=thirdparty%2Fsystemd.git login: provide delayed action in ScheduledShutdown property Even though we can get the existence of delayed action through PreparingForShutdownWithMetadata property or friends, for consistency with CancelScheduledShutdown() method, it is better to also provide the information through ScheduledShutdown property. --- diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index ee449a8445d..04c09ba8ab8 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -412,10 +412,23 @@ static int property_get_scheduled_shutdown( if (r < 0) return r; - r = sd_bus_message_append( - reply, "st", - handle_action_to_string(m->scheduled_shutdown_action), - m->scheduled_shutdown_timeout); + if (m->delayed_action) { + usec_t t = m->scheduled_shutdown_timeout; /* fall back to the schedule time on failure below */ + + if (m->inhibit_timeout_source) { + r = sd_event_source_get_time(m->inhibit_timeout_source, &t); + if (r < 0) + log_debug_errno(r, "Failed to get time of inhibit timeout event source, ignoring: %m"); + } + + r = sd_bus_message_append( + reply, "st", + handle_action_to_string(m->delayed_action->handle), t); + } else + r = sd_bus_message_append( + reply, "st", + handle_action_to_string(m->scheduled_shutdown_action), + m->scheduled_shutdown_timeout); if (r < 0) return r;