diff options
author | 2014-07-03 15:50:31 +0200 | |
---|---|---|
committer | 2014-07-03 15:50:31 +0200 | |
commit | 55ebf98cbecdad288ba2e3f63f7026280c62f025 (patch) | |
tree | 76db71ebb10129436002fc98483f0a34c42288e6 | |
parent | update TODO (diff) | |
download | systemd-55ebf98cbecdad288ba2e3f63f7026280c62f025.tar.gz systemd-55ebf98cbecdad288ba2e3f63f7026280c62f025.tar.bz2 systemd-55ebf98cbecdad288ba2e3f63f7026280c62f025.zip |
core: introduce exit_status_set_is_empty() to make things a bit easier to read
-rw-r--r-- | src/core/service.c | 2 | ||||
-rw-r--r-- | src/shared/exit-status.c | 7 | ||||
-rw-r--r-- | src/shared/exit-status.h | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c index be88670bd..0b19767d9 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.status))) { + if (s->type == SERVICE_ONESHOT && !exit_status_set_is_empty(&s->restart_force_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; } diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c index 942ac8612..f3434f7cc 100644 --- a/src/shared/exit-status.c +++ b/src/shared/exit-status.c @@ -216,3 +216,10 @@ void exit_status_set_free(ExitStatusSet *x) { set_free(x->signal); x->status = x->signal = NULL; } + +bool exit_status_set_is_empty(ExitStatusSet *x) { + if (!x) + return true; + + return set_isempty(x->status) && set_isempty(x->signal); +} diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h index 744f2d537..7438508e4 100644 --- a/src/shared/exit-status.h +++ b/src/shared/exit-status.h @@ -97,3 +97,4 @@ bool is_clean_exit(int code, int status, ExitStatusSet *success_status); bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status); void exit_status_set_free(ExitStatusSet *x); +bool exit_status_set_is_empty(ExitStatusSet *x); |