stop namespaced services with specified pids

The previous fix excludes PIDs of processes running in a different namespace
regardless of whether the PID has been explicitly stored in a PID file mentioned
in the --pidfile parameter.  The correct behavior is to only exclude the pid if
it is not stored in a pidfile.

X-Gentoo-Bug: 776010
X-Gentoo-Bug-URL: https://bugs.gentoo.org/776010
This commit is contained in:
William Hubbs 2021-03-22 11:34:41 -05:00
parent fccd37c34c
commit ef76a663bc

View File

@ -160,7 +160,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid)
proc_ns[0] = '\0';
}
free(buffer);
if (strlen(my_ns) && strlen (proc_ns) && strcmp(my_ns, proc_ns))
if (pid == 0 && strlen(my_ns) && strlen (proc_ns) && strcmp(my_ns, proc_ns))
continue;
if (uid) {
xasprintf(&buffer, "/proc/%d", p);