From: Christophe Fergeau Date: Sat, 2 Mar 2013 14:19:47 +0000 (+0100) Subject: qemu: Use -1 as unpriviledged uid/gid X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=aff6942c23713853d82fcb9acab970b75538bd07;p=libvirt.git qemu: Use -1 as unpriviledged uid/gid Commit f506a4c1 changed virSetUIDGID() to be a noop when uid/gid are -1, while it used to be a noop when they are <= 0. The changes in this commit broke creating new VMs in GNOME Boxes as qemuDomainCheckDiskPresence gets called during domain creation/startup, which in turn calls virFileAccessibleAs which fails after calling virSetUIDGID(0, 0) (Boxes uses session libvirtd). virSetUIDGID is called with (0, 0) as these are the default user/group values in virQEMUDriverConfig for session libvirtd. This commit changes virQEMUDriverConfigNew to use -1 as the unpriviledged uid/gid. I've also looked at the various places where cfg->user is used, and they all seem to handle -1 correctly. --- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index f3b09cf954..3ef3499bbd 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -129,8 +129,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) if (virGetGroupID(QEMU_GROUP, &cfg->group) < 0) goto error; } else { - cfg->user = 0; - cfg->group = 0; + cfg->user = (uid_t)-1; + cfg->group = (gid_t)-1; } cfg->dynamicOwnership = privileged;