mirror of
https://github.com/systemd/systemd.git
synced 2026-08-13 17:08:14 +00:00
Merge pull request #25936 from poettering/emergaction-fix
EmergencyAction parsing fix
This commit is contained in:
@@ -5581,35 +5581,26 @@ int config_parse_emergency_action(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
Manager *m = NULL;
|
||||
EmergencyAction *x = ASSERT_PTR(data);
|
||||
bool is_system;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
|
||||
/* If we have a unit determine the scope based on it */
|
||||
if (unit)
|
||||
m = ((Unit*) userdata)->manager;
|
||||
is_system = MANAGER_IS_SYSTEM(((Unit*) ASSERT_PTR(userdata))->manager);
|
||||
else
|
||||
m = data;
|
||||
is_system = ltype; /* otherwise, assume the scope is passed in via ltype */
|
||||
|
||||
r = parse_emergency_action(rvalue, MANAGER_IS_SYSTEM(m), x);
|
||||
r = parse_emergency_action(rvalue, is_system, 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_WARNING, filename, line, r,
|
||||
"%s= specified as %s mode action, ignoring: %s",
|
||||
lvalue, MANAGER_IS_SYSTEM(m) ? "user" : "system", rvalue);
|
||||
lvalue, is_system ? "user" : "system", rvalue);
|
||||
else
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse %s=, ignoring: %s", lvalue, rvalue);
|
||||
|
||||
@@ -683,7 +683,7 @@ static int parse_config_file(void) {
|
||||
{ "Manager", "DefaultMemoryAccounting", config_parse_bool, 0, &arg_default_memory_accounting },
|
||||
{ "Manager", "DefaultTasksAccounting", config_parse_bool, 0, &arg_default_tasks_accounting },
|
||||
{ "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_default_tasks_max },
|
||||
{ "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, 0, &arg_cad_burst_action },
|
||||
{ "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, arg_system, &arg_cad_burst_action },
|
||||
{ "Manager", "DefaultOOMPolicy", config_parse_oom_policy, 0, &arg_default_oom_policy },
|
||||
{ "Manager", "DefaultOOMScoreAdjust", config_parse_oom_score_adjust, 0, NULL },
|
||||
{ "Manager", "ReloadLimitIntervalSec", config_parse_sec, 0, &arg_reload_limit_interval_sec },
|
||||
|
||||
Reference in New Issue
Block a user