diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/load-fragment.c | 14 | ||||
-rw-r--r-- | src/core/service.c | 6 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 0f5e71b8d3..b6894d22ae 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2935,13 +2935,9 @@ int config_parse_set_status( assert(rvalue); assert(data); + /* Empty assignment resets the list */ if (isempty(rvalue)) { - /* Empty assignment resets the list */ - - set_free(status_set->signal); - set_free(status_set->code); - - status_set->signal = status_set->code = NULL; + exit_status_set_free(status_set); return 0; } @@ -2958,7 +2954,7 @@ int config_parse_set_status( val = signal_from_string_try_harder(temp); if (val > 0) { - r = set_ensure_allocated(&status_set->signal, trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&status_set->signal, NULL, NULL); if (r < 0) return log_oom(); @@ -2975,11 +2971,11 @@ int config_parse_set_status( if (val < 0 || val > 255) log_syntax(unit, LOG_ERR, filename, line, ERANGE, "Value %d is outside range 0-255, ignoring", val); else { - r = set_ensure_allocated(&status_set->code, trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&status_set->status, NULL, NULL); if (r < 0) return log_oom(); - r = set_put(status_set->code, INT_TO_PTR(val)); + r = set_put(status_set->status, INT_TO_PTR(val)); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, -r, "Unable to store: %s", w); return r; diff --git a/src/core/service.c b/src/core/service.c index e221899591..be88670bd8 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -335,7 +335,7 @@ static int service_verify(Service *s) { return -EINVAL; } - if (s->type == SERVICE_ONESHOT && !(set_isempty(s->restart_force_status.signal) && set_isempty(s->restart_force_status.code))) { + if (s->type == SERVICE_ONESHOT && !(set_isempty(s->restart_force_status.signal) && set_isempty(s->restart_force_status.status))) { log_error_unit(UNIT(s)->id, "%s has RestartForceStatus= set, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id); return -EINVAL; } @@ -1071,9 +1071,9 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) (s->restart == SERVICE_RESTART_ON_ABNORMAL && !IN_SET(s->result, SERVICE_SUCCESS, SERVICE_FAILURE_EXIT_CODE)) || (s->restart == SERVICE_RESTART_ON_WATCHDOG && s->result == SERVICE_FAILURE_WATCHDOG) || (s->restart == SERVICE_RESTART_ON_ABORT && IN_SET(s->result, SERVICE_FAILURE_SIGNAL, SERVICE_FAILURE_CORE_DUMP)) || - (s->main_exec_status.code == CLD_EXITED && set_contains(s->restart_force_status.code, INT_TO_PTR(s->main_exec_status.status))) || + (s->main_exec_status.code == CLD_EXITED && set_contains(s->restart_force_status.status, INT_TO_PTR(s->main_exec_status.status))) || (IN_SET(s->main_exec_status.code, CLD_KILLED, CLD_DUMPED) && set_contains(s->restart_force_status.signal, INT_TO_PTR(s->main_exec_status.status)))) && - (s->main_exec_status.code != CLD_EXITED || !set_contains(s->restart_prevent_status.code, INT_TO_PTR(s->main_exec_status.status))) && + (s->main_exec_status.code != CLD_EXITED || !set_contains(s->restart_prevent_status.status, INT_TO_PTR(s->main_exec_status.status))) && (!IN_SET(s->main_exec_status.code, CLD_KILLED, CLD_DUMPED) || !set_contains(s->restart_prevent_status.signal, INT_TO_PTR(s->main_exec_status.status)))) { r = service_arm_timer(s, s->restart_usec); |