logind-dbus: refuse multiple jobs in method_do_shutdown_or_sleep too

Fixes #30917
This commit is contained in:
Mike Yuan
2024-01-14 05:14:42 +08:00
parent 1f4cb8c9cf
commit 3eb8acda96

View File

@@ -2128,6 +2128,12 @@ static int method_do_shutdown_or_sleep(
if (r != 0)
return r;
if (m->delayed_action)
return sd_bus_error_setf(error, BUS_ERROR_OPERATION_IN_PROGRESS,
"Action %s already in progress, refusing requested %s operation.",
handle_action_to_string(m->delayed_action->handle),
handle_action_to_string(a->handle));
/* reset case we're shorting a scheduled shutdown */
m->unlink_nologin = false;
reset_scheduled_shutdown(m);