]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
chown_mapped_rootid: don't double-map root id
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 4 Mar 2014 15:58:30 +0000 (09:58 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 4 Mar 2014 16:11:13 +0000 (11:11 -0500)
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 <apw@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c

index 26223710e6ec9eee851993973bceed6ceb13df1b..1cb058d0c02636d43d87b8369006f139ddc6da48 100644 (file)
@@ -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");