]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont()
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Jul 2016 09:14:48 +0000 (11:14 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Jul 2016 09:14:48 +0000 (11:14 +0200)
src/basic/process-util.c

index e38b67405e45f96f537cc7fc160d32c114c77818..54b644ad56b5ea1efa74c6e0d99f193b0efe32bd 100644 (file)
@@ -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;
 }