X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-action.c;h=9b2ec6e24258652fee94f4732886ba743e01b19f;hp=eba097c61dcb4f0f656a7b294bc4de73d3bc3ad8;hb=c73bfb05cb09992935ede3247a1cc4726e54a44d;hpb=e19b8719a54c343372e16b462c27f1e84c987b85 diff --git a/src/login/logind-action.c b/src/login/logind-action.c index eba097c61..9b2ec6e24 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -154,7 +154,6 @@ int manager_handle_action( offending->uid, strna(u), offending->pid, strna(comm)); - warn_melody(); return -EPERM; } @@ -240,8 +239,7 @@ static int write_state(FILE **f, char **states) { return r; } -static int do_sleep(const char *arg_verb) { - _cleanup_strv_free_ char **modes = NULL, **states = NULL; +static int do_sleep(const char *arg_verb, char **modes, char **states) { char *arguments[] = { NULL, (char*) "pre", @@ -288,7 +286,10 @@ static int do_sleep(const char *arg_verb) { return r; } -int shutdown_or_sleep(HandleAction action) { +int shutdown_or_sleep(Manager *m, HandleAction action) { + + assert(m); + switch (action) { case HANDLE_POWEROFF: return run_helper(HALT); @@ -299,11 +300,11 @@ int shutdown_or_sleep(HandleAction action) { case HANDLE_KEXEC: return run_helper(KEXEC); case HANDLE_SUSPEND: - return do_sleep("suspend"); + return do_sleep("suspend", m->suspend_mode, m->suspend_state); case HANDLE_HIBERNATE: - return do_sleep("hibernate"); + return do_sleep("hibernate", m->hibernate_mode, m->hibernate_state); case HANDLE_HYBRID_SLEEP: - return do_sleep("hybrid-sleep"); + return do_sleep("hybrid-sleep", m->hybrid_sleep_mode, m->hybrid_sleep_state); default: return -EINVAL; }