summaryrefslogtreecommitdiff
path: root/src/core/service.c
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2017-09-29 00:37:23 +0200
committerAndreas Rammhold <andreas@rammhold.de>2017-10-02 13:09:54 +0200
commit3742095b27f8df4b195d530b52d15bc5fea70bf1 (patch)
tree3fc7c3503845b733f1d58366436c0bb672d3613a /src/core/service.c
parent01a65d4180446661732d90d23a24ab692d279295 (diff)
downloadsystemd-3742095b27f8df4b195d530b52d15bc5fea70bf1.tar.gz
tree-wide: use IN_SET where possible
In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
Diffstat (limited to 'src/core/service.c')
-rw-r--r--src/core/service.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 1a4455bd22..fb8a970a27 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -529,7 +529,7 @@ static int service_verify(Service *s) {
if (s->bus_name && s->type != SERVICE_DBUS)
log_unit_warning(UNIT(s), "Service has a D-Bus service name specified, but is not of type dbus. Ignoring.");
- if (s->exec_context.pam_name && !(s->kill_context.kill_mode == KILL_CONTROL_GROUP || s->kill_context.kill_mode == KILL_MIXED)) {
+ if (s->exec_context.pam_name && !IN_SET(s->kill_context.kill_mode, KILL_CONTROL_GROUP, KILL_MIXED)) {
log_unit_error(UNIT(s), "Service has PAM enabled. Kill mode must be set to 'control-group' or 'mixed'. Refusing.");
return -EINVAL;
}
@@ -2224,7 +2224,7 @@ static int service_reload(Unit *u) {
assert(s);
- assert(s->state == SERVICE_RUNNING || s->state == SERVICE_EXITED);
+ assert(IN_SET(s->state, SERVICE_RUNNING, SERVICE_EXITED));
service_enter_reload(s);
return 1;
@@ -2755,7 +2755,7 @@ static int service_retry_pid_file(Service *s) {
int r;
assert(s->pid_file);
- assert(s->state == SERVICE_START || s->state == SERVICE_START_POST);
+ assert(IN_SET(s->state, SERVICE_START, SERVICE_START_POST));
r = service_load_pid_file(s, false);
if (r < 0)
@@ -2826,7 +2826,7 @@ static int service_dispatch_io(sd_event_source *source, int fd, uint32_t events,
assert(s);
assert(fd >= 0);
- assert(s->state == SERVICE_START || s->state == SERVICE_START_POST);
+ assert(IN_SET(s->state, SERVICE_START, SERVICE_START_POST));
assert(s->pid_file_pathspec);
assert(path_spec_owns_inotify_fd(s->pid_file_pathspec, fd));