From: Zbigniew Jędrzejewski-Szmek Date: Tue, 30 Dec 2014 23:38:21 +0000 (-0500) Subject: systemctl: do not repeat hibernate/sleep attempts X-Git-Tag: v219~748 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a39b4bdd10fc15654db37459fe8235a3de1ad817;p=elogind.git systemctl: do not repeat hibernate/sleep attempts If some sleep operation was not possible (e.g. because swap is missing), we would try twice: once through logind, which would result in a clean error: Failed to execute operation: Sleep verb not supported and then second time by starting the appropriate unit directly, which is more messy. If logind tells us that something is not possible (or already in progress), report that to the user and quit. If logind is present and working we should not try to work around it. Loosely based on https://bugs.freedesktop.org/show_bug.cgi?id=87832. --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index a6c7e91f5..9c4b9ed27 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -2966,7 +2966,7 @@ static int start_special(sd_bus *bus, char **args) { a == ACTION_HIBERNATE || a == ACTION_HYBRID_SLEEP)) { r = reboot_with_logind(bus, a); - if (r >= 0) + if (r >= 0 || IN_SET(r, -ENOTSUP, -EINPROGRESS)) return r; }