[lxc-devel] [PATCH] Invoke lxc_map_ids only when id_map is not empty

Alexander Vladimirov alexander.idkfa.vladimirov at gmail.com
Wed Mar 13 14:25:34 UTC 2013


Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov at gmail.com>
---
 src/lxc/start.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index 3fdfa04..05646c2 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -823,9 +823,11 @@ int lxc_spawn(struct lxc_handler *handler)
 	 * call doesn't change anything immediately, but allows the
 	 * container to setuid(0) (0 being mapped to something else on
 	 * the host) later to become a valid uid again */
-	if (lxc_map_ids(&handler->conf->id_map, handler->pid)) {
-		ERROR("failed to set up id mapping");
-		goto out_delete_net;
+	if (!lxc_list_empty(&handler->conf->id_map)) {
+		if (lxc_map_ids(&handler->conf->id_map, handler->pid)) {
+			ERROR("failed to set up id mapping");
+			goto out_delete_net;
+		}
 	}
 
 	/* Tell the child to continue its initialization.  we'll get
-- 
1.8.1.5





More information about the lxc-devel mailing list