util: Allow virProcessSetNamespaces() to have sparse FD list

So far, the virProcessSetNamespaces() takes an array of FDs that
it tries to set namespace on. However, in the very next commit
this array may be sparse, having some -1's in it. Teach the
function to cope with that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-08-27 02:09:54 +02:00
parent 52970dec5b
commit ea0486873e

View File

@ -705,6 +705,9 @@ int virProcessSetNamespaces(size_t nfdlist,
return -1;
}
for (i = 0; i < nfdlist; i++) {
if (fdlist[i] < 0)
continue;
/* We get EINVAL if new NS is same as the current
* NS, or if the fd namespace doesn't match the
* type passed to setns()'s second param. Since we