rc_find_pids: namespace fix

Ignore namespaces if there are errors reading either the pid namespace
for the current process or the process we aare testing.

This fixes https://github.com/openrc/openrc/issues/180.
This commit is contained in:
William Hubbs 2017-11-13 16:54:57 -06:00
parent 90d9ea656f
commit 971e82784c

View File

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