]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
do_rootfs_setup: fix return bugs
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 27 Oct 2014 03:01:30 +0000 (22:01 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 25 Nov 2014 22:06:57 +0000 (17:06 -0500)
Fix return value on bind mount failure.

If we've already mounted the rootfs, exit after the bind mount
rather than re-trying the rootfs mount.  The only case where
this happens is when root is starting a container in a user
namespace and with a block device backing store.

In that case, pre-mount hooks will be executed in the initial
user namespace.  That may be worth fixing.  Or it may be what
we want.  We should think about it and fix it.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c

index a7d090429c50d343ace4fd9d960f6a6676c195f3..f2215a8afb6834bd28e10dcbbbe68570edccb32b 100644 (file)
@@ -4063,8 +4063,9 @@ int do_rootfs_setup(struct lxc_conf *conf, const char *name, const char *lxcpath
                const char *path = conf->rootfs.mount;
                if (mount(path, path, "rootfs", MS_BIND, NULL) < 0) {
                        ERROR("Failed to bind-mount container / onto itself");
-                       return false;
+                       return -1;
                }
+               return 0;
        }
 
        remount_all_slave();