diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/load-fragment.c | 14 | ||||
| -rw-r--r-- | src/core/service.c | 6 | ||||
| -rw-r--r-- | src/shared/exit-status.c | 6 | ||||
| -rw-r--r-- | src/shared/exit-status.h | 2 | 
4 files changed, 12 insertions, 16 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); diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c index 38d71e182d..942ac86128 100644 --- a/src/shared/exit-status.c +++ b/src/shared/exit-status.c @@ -183,7 +183,7 @@ bool is_clean_exit(int code, int status, ExitStatusSet *success_status) {          if (code == CLD_EXITED)                  return status == 0 ||                         (success_status && -                       set_contains(success_status->code, INT_TO_PTR(status))); +                       set_contains(success_status->status, INT_TO_PTR(status)));          /* If a daemon does not implement handlers for some of the           * signals that's not considered an unclean shutdown */ @@ -212,7 +212,7 @@ bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status) {  void exit_status_set_free(ExitStatusSet *x) {          assert(x); -        set_free(x->code); +        set_free(x->status);          set_free(x->signal); -        x->code = x->signal = NULL; +        x->status = x->signal = NULL;  } diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h index 93abf7f10e..744f2d5376 100644 --- a/src/shared/exit-status.h +++ b/src/shared/exit-status.h @@ -87,7 +87,7 @@ typedef enum ExitStatusLevel {  } ExitStatusLevel;  typedef struct ExitStatusSet { -        Set *code; +        Set *status;          Set *signal;  } ExitStatusSet; | 
