Fix ordering of file open in virProcessGetNamespaces
virProcessGetNamespaces() opens files in /proc/XXX/ns/ which will later be passed to setns(). We have to make sure that the file descriptors in the array are in the correct order. In particular the 'user' namespace must be first otherwise setns() may fail for other namespaces. The order has been taken from util-linux's sys-utils/nsenter.c Also we must ignore EINVAL in setns() which occurs if the namespace associated with the fd, matches the calling process' current namespace. Signed-off-by: NRichard Weinberger <richard@nod.at> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
Showing
想要评论请 注册 或 登录