From: Lennart Poettering Date: Wed, 20 Jul 2016 09:14:48 +0000 (+0200) Subject: util: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont() X-Git-Tag: v231.3~70 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=10ca952061a7fc8581b194678700e15a8e1a53e4;p=elogind.git util: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont() --- diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 291252979..c976f1f68 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -631,8 +631,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; }