mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 16:34:45 +07:00
dbus: refuse Manager1.Suspend in bootstrap and shutdown
The legacy INIT_CMD_SUSPEND is refused in runlevel S, 0, and 6, the bus method suspended unconditionally, even mid-shutdown. Add the same guard, replying WrongRunlevel like the reboot family. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -535,6 +535,10 @@ static int manager_signal(link_call_t *call, void *u)
|
||||
static int manager_suspend(link_call_t *call, void *u)
|
||||
{
|
||||
(void)u;
|
||||
if (IS_RESERVED_RUNLEVEL(runlevel))
|
||||
return link_call_reply_error(call,
|
||||
"org.finit.Error.WrongRunlevel",
|
||||
"Unsupported command in runlevel S and 6/0");
|
||||
sync();
|
||||
if (suspend() < 0) {
|
||||
const char *msg = (errno == EINVAL)
|
||||
|
||||
Reference in New Issue
Block a user