core: accept system mode emergency action specifiers with a warning

Before we would only accept those "system" values, so there wasn't other
chocie. Let's provide backwards compatiblity in case somebody made use of
this functionality in user mode.

v2: use 'exit-force' not 'exit'
v3: use error value in log_syntax
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-10-16 14:49:36 +02:00
parent 54fcb6192c
commit 469f76f170
1 changed files with 10 additions and 0 deletions

View File

@ -4212,6 +4212,16 @@ int config_parse_emergency_action(
r = parse_emergency_action(rvalue, MANAGER_IS_SYSTEM(m), x);
if (r < 0) {
if (r == -EOPNOTSUPP && MANAGER_IS_USER(m)) {
/* Compat mode: remove for systemd 241. */
log_syntax(unit, LOG_INFO, filename, line, r,
"%s= in user mode specified as \"%s\", using \"exit-force\" instead.",
lvalue, rvalue);
*x = EMERGENCY_ACTION_EXIT_FORCE;
return 0;
}
if (r == -EOPNOTSUPP)
log_syntax(unit, LOG_ERR, filename, line, r,
"%s= specified as %s mode action, ignoring: %s",