]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
lxc_container: Don't call virGetGroupList during exec
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 17 Jul 2013 09:21:09 +0000 (11:21 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 17 Jul 2013 12:26:09 +0000 (14:26 +0200)
Commit 75c1256 states that virGetGroupList must not be called
between fork and exec, then commit ee777e99 promptly violated
that for lxc.

Patch originally posted by Eric Blake <eblake@redhat.com>.

src/lxc/lxc_container.c

index b51d7a2e8553f1d13d35f4ff234892266bbef1f0..ca8a39ec8fd3f01ca25f77e2f28e794e43dbebfc 100644 (file)
@@ -351,24 +351,18 @@ int lxcContainerWaitForContinue(int control)
  */
 static int lxcContainerSetID(virDomainDefPtr def)
 {
-    gid_t *groups;
-    int ngroups;
-
     /* Only call virSetUIDGID when user namespace is enabled
      * for this container. And user namespace is only enabled
      * when nuidmap&ngidmap is not zero */
 
     VIR_DEBUG("Set UID/GID to 0/0");
     if (def->idmap.nuidmap &&
-        ((ngroups = virGetGroupList(0, 0, &groups) < 0) ||
-         virSetUIDGID(0, 0, groups, ngroups) < 0)) {
+        virSetUIDGID(0, 0, NULL, 0) < 0) {
         virReportSystemError(errno, "%s",
                              _("setuid or setgid failed"));
-        VIR_FREE(groups);
         return -1;
     }
 
-    VIR_FREE(groups);
     return 0;
 }