]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: fix block-device based rootfs mounting 3601/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 14 Dec 2020 16:52:44 +0000 (17:52 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 14 Dec 2020 16:52:44 +0000 (17:52 +0100)
Fixes: #3598
Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index 9f631e0c237a327f4b40df2d5210206e87ec8d58..27f97066876d2a8237a1ac45ed1e499999f213a9 100644 (file)
@@ -3135,6 +3135,10 @@ int lxc_setup_rootfs_prepare_root(struct lxc_conf *conf, const char *name,
                if (ret < 0)
                        return log_error(-1, "Failed to bind mount container / onto itself");
 
+               conf->rootfs.mntpt_fd = openat(-EBADF, path, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH | O_NOCTTY);
+               if (conf->rootfs.mntpt_fd < 0)
+                       return log_error_errno(-errno, errno, "Failed to open file descriptor for container rootfs");
+
                return log_trace(0, "Bind mounted container / onto itself");
        }