diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-15 15:01:40 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-12-09 13:53:31 -0500 |
commit | 59ec09a83e426a27252c0fd855b5338db53c8fba (patch) | |
tree | 313b3c407c5d4c65e3a3cf990a277718f2646914 /src/core/unit.c | |
parent | b200489b2b0ebb45be80fc8168be1f0587ae2bcc (diff) |
pid1: simplify the logic in two statements related to killing processes
Generally non-inverted conditions are nicer, and ternary operators
with complex conditions are a bit hard to read.
No functional change.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r-- | src/core/unit.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index e485c01fc1..ab40135736 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3755,14 +3755,14 @@ int unit_kill_context( bool main_pid_alien) { bool wait_for_exit = false, send_sighup; - cg_kill_log_func_t log_func; + cg_kill_log_func_t log_func = NULL; int sig, r; assert(u); assert(c); - /* Kill the processes belonging to this unit, in preparation for shutting the unit down. Returns > 0 if we - * killed something worth waiting for, 0 otherwise. */ + /* Kill the processes belonging to this unit, in preparation for shutting the unit down. + * Returns > 0 if we killed something worth waiting for, 0 otherwise. */ if (c->kill_mode == KILL_NONE) return 0; @@ -3774,9 +3774,8 @@ int unit_kill_context( IN_SET(k, KILL_TERMINATE, KILL_TERMINATE_AND_LOG) && sig != SIGHUP; - log_func = - k != KILL_TERMINATE || - IN_SET(sig, SIGKILL, SIGABRT) ? log_kill : NULL; + if (k != KILL_TERMINATE || IN_SET(sig, SIGKILL, SIGABRT)) + log_func = log_kill; if (main_pid > 0) { if (log_func) |