X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Flogin%2Flogind-action.c;h=a796ebe9eca24ab2842f4c564eebac8d0dffd517;hb=5d1fb81b2c602abd2605f6e50810ac7fcb06c024;hp=e1517d6ac2573d28e045c143eb8538dd4b5d2083;hpb=f274ece0f76b5709408821e317e87aef76123db6;p=elogind.git diff --git a/src/login/logind-action.c b/src/login/logind-action.c index e1517d6ac..a796ebe9e 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -56,10 +56,15 @@ int manager_handle_action( DBusError error; int r; InhibitWhat inhibit_operation; - bool supported = true; + bool supported; assert(m); + if (m->action_job || m->delayed_unit) { + log_debug("Action already in progress, ignoring."); + return -EALREADY; + } + /* If the key handling is turned off, don't do anything */ if (handle == HANDLE_IGNORE) { log_debug("Refusing operation, as it is turned off."); @@ -74,6 +79,8 @@ int manager_handle_action( supported = can_sleep("disk") > 0 && can_sleep_disk("suspend") > 0; else if (handle == HANDLE_KEXEC) supported = access("/sbin/kexec", X_OK) >= 0; + else + supported = true; if (!supported) { log_warning("Requested operation not supported, ignoring.");