chiark / gitweb /
Prep 235: Don't allow multiple jobs being executed at the same time
authorSven Eden <yamakuzure@gmx.net>
Sun, 14 Jan 2018 17:07:25 +0000 (18:07 +0100)
committerSven Eden <yamakuzure@gmx.net>
Sun, 14 Jan 2018 17:07:25 +0000 (18:07 +0100)
src/login/elogind-dbus.c

index ede2bfd356a75d7d9009cbf874d9c44128de063d..16b0b7939504561880411a2e74092b9e640dcac3 100644 (file)
@@ -434,9 +434,17 @@ int manager_scheduled_shutdown_handler(
         else
                 action = HANDLE_REBOOT;
 
+        /* Don't allow multiple jobs being executed at the same time */
+        if (m->action_what) {
+                log_error("Scheduled shutdown to %s failed: shutdown or sleep operation already in progress",
+                          m->scheduled_shutdown_type);
+                return -EALREADY;
+        }
+
         r = execute_shutdown_or_sleep(m, 0, action, &error);
         if (r < 0)
-                return log_error_errno(r, "Unable to execute transition to %s: %m", m->scheduled_shutdown_type);
+                return log_error_errno(r, "Scheduled shutdown to %s failed: %m",
+                                       m->scheduled_shutdown_type);
 
         return 0;
 }