chiark / gitweb /
fileio: imply /tmp as directory if passed as NULL to open_tmpfile_unlinkable()
[elogind.git] / src / basic / process-util.c
index c9115f85eff0630940c4ed167c333d0e7c58c6ed..c976f1f6891fda039fae84296acd91acba26aa2f 100644 (file)
@@ -195,7 +195,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
 
                                 *(k++) = (char) c;
                                 left--;
 
                                 *(k++) = (char) c;
                                 left--;
-                        }  else if (k > r)
+                        } else if (k > r)
                                 space = true;
                 }
 
                                 space = true;
                 }
 
@@ -631,8 +631,10 @@ int kill_and_sigcont(pid_t pid, int sig) {
 
         r = kill(pid, sig) < 0 ? -errno : 0;
 
 
         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;
 }
 
         return r;
 }