summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-07-20 11:14:48 +0200
committerLennart Poettering <lennart@poettering.net>2016-07-20 11:14:48 +0200
commit26f417d3e8dd2522adfdc4c8fed4c36fa40f48fc (patch)
tree54509de7760801322716ebb2116f5eb34c0bdb58
parent801a884d1ec66d8174b0e6dd9834f69165da94b5 (diff)
util: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont()
-rw-r--r--src/basic/process-util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index e38b67405e..54b644ad56 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -625,8 +625,10 @@ int kill_and_sigcont(pid_t pid, int sig) {
r = kill(pid, sig) < 0 ? -errno : 0;
- if (r >= 0)
- kill(pid, SIGCONT);
+ /* If this worked, also send SIGCONT, unless we already just sent a SIGCONT, or SIGKILL was sent which isn't
+ * affected by a process being suspended anyway. */
+ if (r >= 0 && !IN_SET(SIGCONT, SIGKILL))
+ (void) kill(pid, SIGCONT);
return r;
}