From: Sven Eden Date: Sun, 14 Jan 2018 17:07:25 +0000 (+0100) Subject: Prep 235: Don't allow multiple jobs being executed at the same time X-Git-Tag: v235.1~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a1d9425d4be6f0b899ba2c49cfe604d741f4f836;p=elogind.git Prep 235: Don't allow multiple jobs being executed at the same time --- diff --git a/src/login/elogind-dbus.c b/src/login/elogind-dbus.c index ede2bfd35..16b0b7939 100644 --- a/src/login/elogind-dbus.c +++ b/src/login/elogind-dbus.c @@ -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; }