]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Fix ordering of file open in virProcessGetNamespaces
authorRichard Weinberger <richard@nod.at>
Fri, 7 Jun 2013 16:30:09 +0000 (17:30 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 7 Jun 2013 16:59:54 +0000 (17:59 +0100)
commit68eea850217e1de921bb1d4bd013aabfac255a23
tree68a45d927fccfcac5e66dc6fdef9a84a79c658d4
parente463f4de77282d872bd1db575d2f691b20c5deff
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: Richard Weinberger <richard@nod.at>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/util/virprocess.c