From f3d7e4ca9230d13dc446dd0ef00dd74b2c11bab6 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Tue, 4 Mar 2014 09:58:30 -0600 Subject: [PATCH] chown_mapped_rootid: don't double-map root id MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If the user maps container root to his host uid, chown_mapped_rootid tries to make the same mapping twice and gets -EINVAL. Reported-by: Andy Whitcroft Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- src/lxc/conf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 26223710e..1cb058d0c 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -3439,6 +3439,13 @@ int chown_mapped_root(char *path, struct lxc_conf *conf) } return 0; } + + if (rootid == geteuid()) { + // nothing to do + INFO("%s: container root is our uid; no need to chown" ,__func__); + return 0; + } + pid = fork(); if (pid < 0) { SYSERROR("Failed forking"); -- 2.47.2