]> xenbits.xensource.com Git - libvirt.git/commitdiff
Skip debug message in lxcContainerSetID if no map is set.
authorChen Hanxiao <chenhanxiao@cn.fujitsu.com>
Mon, 28 Oct 2013 11:18:26 +0000 (11:18 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 28 Oct 2013 11:19:20 +0000 (11:19 +0000)
The lxcContainerSetID() method prints a misleading log
message about setting the uid/gid when no ID map is
present in the XML config. Skip the debug message in
this case.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
src/lxc/lxc_container.c

index 56df69e387df592fe4a7e0503782e308bce5a1fd..1ec59d5c6ef2cbe362a0e2499882c9d3a6a46967 100644 (file)
@@ -420,9 +420,11 @@ static int lxcContainerSetID(virDomainDefPtr def)
      * 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 &&
-        virSetUIDGID(0, 0, NULL, 0) < 0) {
+    if (!def->idmap.nuidmap)
+        return 0;
+
+    VIR_DEBUG("Setting UID/GID to 0/0");
+    if (virSetUIDGID(0, 0, NULL, 0) < 0) {
         virReportSystemError(errno, "%s",
                              _("setuid or setgid failed"));
         return -1;