[lxc-devel] [PATCH] userns_exec_1: catch errors in the spawned process.

Serge Hallyn serge.hallyn at ubuntu.com
Wed Jan 29 15:17:06 UTC 2014


lxc_map_ids can call system(3), which on error from the
spawned process returns > 0.  No path should return > 0
when it meant success.  So check the lxc_map_ids() value
to be != rather than just < 0.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 71b3407..7dc1fef 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -4055,7 +4055,7 @@ int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data)
 	ret = lxc_map_ids(idmap, pid);
 	lxc_free_idmap(idmap);
 	free(idmap);
-	if (ret < 0) {
+	if (ret) {
 		ERROR("Error setting up child mappings");
 		goto err;
 	}
-- 
1.8.5.3



More information about the lxc-devel mailing list