mirror of
https://github.com/troglobit/finit.git
synced 2026-10-27 12:20:54 +00:00
dbus: mirror legacy runlevel edge cases in Manager1.SetRunlevel
The bus method called sm_runlevel() unconditionally. In runlevel 0 and 6 that aborts an in-flight shutdown, which INIT_CMD_RUNLVL refuses with a warning, and during bootstrap it switches immediately where the legacy path defers via cfglevel to the end of runlevel S. Port both. A bad runlevel argument still returns InvalidArgs, where the legacy protocol acks silently: a typed interface rejects garbage. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+29
-23
No files matched your search
+1
-3
@@ -454,9 +454,7 @@ static int manager_set_runlevel(link_call_t *call, void *userdata)
|
||||
"org.freedesktop.DBus.Error.InvalidArgs",
|
||||
"runlevel must be 0-9 (excluding internal levels)");
|
||||
|
||||
if (lvl == 0) halt = SHUT_OFF;
|
||||
if (lvl == 6) halt = SHUT_REBOOT;
|
||||
sm_runlevel((int)lvl);
|
||||
sm_request_runlevel((int)lvl);
|
||||
|
||||
(void)link_call_reply(call);
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user