]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind-dbus: refuse multiple jobs in method_do_shutdown_or_sleep too 30927/head
authorMike Yuan <me@yhndnzj.com>
Sat, 13 Jan 2024 21:14:42 +0000 (05:14 +0800)
committerMike Yuan <me@yhndnzj.com>
Sat, 13 Jan 2024 21:14:42 +0000 (05:14 +0800)
Fixes #30917

src/login/logind-dbus.c

index 2b993fd842f85d30768e70f7923d29a3c3ae4b66..932eb42b4e8d5fe89277166d0b34e84183028d43 100644 (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);