units: allow and use SuccessAction=exit-force in system systemd-exit.service

C.f. 287419c119: 'systemctl exit 42' can be
used to set an exit value and pulls in exit.target, which pulls in systemd-exit.service,
which calls org.fdo.Manager.Exit, which calls method_exit(), which sets the objective
to MANAGER_EXIT. Allow the same to happen through SuccessAction=exit.

v2: update for 'exit' and 'exit-force'
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-10-17 19:32:07 +02:00
parent afa6206583
commit a400bd8c2a
5 changed files with 24 additions and 23 deletions
+3 -3
View File
@@ -36,10 +36,10 @@ static void test_parse_emergency_action(void) {
assert_se(parse_emergency_action("poweroff-force", true, &x) == 0);
assert_se(x == EMERGENCY_ACTION_POWEROFF_FORCE);
assert_se(parse_emergency_action("poweroff-immediate", true, &x) == 0);
assert_se(parse_emergency_action("exit", true, &x) == -EOPNOTSUPP);
assert_se(parse_emergency_action("exit-force", true, &x) == -EOPNOTSUPP);
assert_se(parse_emergency_action("exit", true, &x) == 0);
assert_se(parse_emergency_action("exit-force", true, &x) == 0);
assert_se(parse_emergency_action("exit-forcee", true, &x) == -EINVAL);
assert_se(x == EMERGENCY_ACTION_POWEROFF_IMMEDIATE);
assert_se(x == EMERGENCY_ACTION_EXIT_FORCE);
}
int main(int argc, char **argv) {