From 8e1336fea9501d4edc456ce9748e63ba684a5917 Mon Sep 17 00:00:00 2001 From: Chen Hanxiao Date: Mon, 28 Oct 2013 11:18:26 +0000 Subject: [PATCH] Skip debug message in lxcContainerSetID if no map is set. 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 --- src/lxc/lxc_container.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 56df69e387..1ec59d5c6e 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -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;