summaryrefslogtreecommitdiffstats
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-01 18:51:44 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-01 18:52:15 +0200
commitb821a397c0fd382266a6018c1b6738ced69f8041 (patch)
tree0110d92df35dc6d23d01432c16c5217a568b2a0d /src/core/unit.c
parentcore: when looking for the unit for a process, look at the PID hashmaps first (diff)
downloadsystemd-b821a397c0fd382266a6018c1b6738ced69f8041.tar.xz
systemd-b821a397c0fd382266a6018c1b6738ced69f8041.zip
unit: small clean-ups
Always say when we ignore errors. Cast calls whose return value we knowingly ingore to (void). Use "bool" where we actually mean a boolean, even if we return it as an int later on.
Diffstat (limited to '')
-rw-r--r--src/core/unit.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 3fec8c4c36..64ab49dc4a 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2017,9 +2017,9 @@ void unit_unwatch_pid(Unit *u, pid_t pid) {
assert(u);
assert(pid >= 1);
- hashmap_remove_value(u->manager->watch_pids1, LONG_TO_PTR(pid), u);
- hashmap_remove_value(u->manager->watch_pids2, LONG_TO_PTR(pid), u);
- set_remove(u->pids, LONG_TO_PTR(pid));
+ (void) hashmap_remove_value(u->manager->watch_pids1, LONG_TO_PTR(pid), u);
+ (void) hashmap_remove_value(u->manager->watch_pids2, LONG_TO_PTR(pid), u);
+ (void) set_remove(u->pids, LONG_TO_PTR(pid));
}
void unit_unwatch_all_pids(Unit *u) {
@@ -3525,7 +3525,8 @@ int unit_kill_context(
pid_t control_pid,
bool main_pid_alien) {
- int sig, wait_for_exit = false, r;
+ bool wait_for_exit = false;
+ int sig, r;
assert(u);
assert(c);
@@ -3554,7 +3555,7 @@ int unit_kill_context(
_cleanup_free_ char *comm = NULL;
get_process_comm(main_pid, &comm);
- log_unit_warning_errno(u, r, "Failed to kill main process " PID_FMT " (%s): %m", main_pid, strna(comm));
+ log_unit_warning_errno(u, r, "Failed to kill main process " PID_FMT " (%s), ignoring: %m", main_pid, strna(comm));
} else {
if (!main_pid_alien)
wait_for_exit = true;
@@ -3571,7 +3572,7 @@ int unit_kill_context(
_cleanup_free_ char *comm = NULL;
get_process_comm(control_pid, &comm);
- log_unit_warning_errno(u, r, "Failed to kill control process " PID_FMT " (%s): %m", control_pid, strna(comm));
+ log_unit_warning_errno(u, r, "Failed to kill control process " PID_FMT " (%s), ignoring: %m", control_pid, strna(comm));
} else {
wait_for_exit = true;
@@ -3580,7 +3581,8 @@ int unit_kill_context(
}
}
- if ((c->kill_mode == KILL_CONTROL_GROUP || (c->kill_mode == KILL_MIXED && k == KILL_KILL)) && u->cgroup_path) {
+ if (u->cgroup_path &&
+ (c->kill_mode == KILL_CONTROL_GROUP || (c->kill_mode == KILL_MIXED && k == KILL_KILL))) {
_cleanup_set_free_ Set *pid_set = NULL;
/* Exclude the main/control pids from being killed via the cgroup */
@@ -3591,7 +3593,8 @@ int unit_kill_context(
r = cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, sig, true, true, false, pid_set);
if (r < 0) {
if (r != -EAGAIN && r != -ESRCH && r != -ENOENT)
- log_unit_warning_errno(u, r, "Failed to kill control group: %m");
+ log_unit_warning_errno(u, r, "Failed to kill control group %s, ignoring: %m", u->cgroup_path);
+
} else if (r > 0) {
/* FIXME: For now, we will not wait for the