diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-07-12 04:05:33 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-07-12 04:05:33 +0200 |
commit | 3611581ebdabbe3a1d6a9b5310a0b59792279d7d (patch) | |
tree | 3652d8d0764fdd90149eb1ed03bd1b8f92d2382c /src/service.c | |
parent | ee17ee7c5cc22c286f943578918beaa78bbc86db (diff) |
service: properly handle who argument on D-Bus kill calls
Diffstat (limited to 'src/service.c')
-rw-r--r-- | src/service.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/service.c b/src/service.c index b684a37cd7..0b657679f7 100644 --- a/src/service.c +++ b/src/service.c @@ -3270,15 +3270,17 @@ static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusErro return -ENOENT; } - if (s->control_pid > 0) - if (kill(s->control_pid, signo) < 0) - r = -errno; + if (who == KILL_CONTROL || who == KILL_ALL) + if (s->control_pid > 0) + if (kill(s->control_pid, signo) < 0) + r = -errno; - if (s->main_pid > 0) - if (kill(s->main_pid, signo) < 0) - r = -errno; + if (who == KILL_MAIN || who == KILL_ALL) + if (s->main_pid > 0) + if (kill(s->main_pid, signo) < 0) + r = -errno; - if (mode == KILL_CONTROL_GROUP) { + if (who == KILL_ALL && mode == KILL_CONTROL_GROUP) { int q; if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func))) @@ -3298,7 +3300,7 @@ static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusErro } if ((q = cgroup_bonding_kill_list(s->meta.cgroup_bondings, signo, false, pid_set)) < 0) - if (r != -EAGAIN && r != -ESRCH && r != -ENOENT) + if (q != -EAGAIN && q != -ESRCH && q != -ENOENT) r = q; } |