conf: fix setups where /dev is outside of LXC's control

parent 448462dd
...@@ -3457,12 +3457,6 @@ int lxc_setup(struct lxc_handler *handler) ...@@ -3457,12 +3457,6 @@ int lxc_setup(struct lxc_handler *handler)
return log_error(-1, "Failed to mount \"/dev\""); return log_error(-1, "Failed to mount \"/dev\"");
} }
lxc_conf->rootfs.dfd_dev = open_at(lxc_conf->rootfs.dfd_mnt, "dev",
PROTECT_OPATH_DIRECTORY,
PROTECT_LOOKUP_BENEATH_XDEV, 0);
if (lxc_conf->rootfs.dfd_dev < 0 && errno != ENOENT)
return log_error_errno(-errno, errno, "Failed to open \"/dev\"");
/* Do automatic mounts (mainly /proc and /sys), but exclude those that /* Do automatic mounts (mainly /proc and /sys), but exclude those that
* need to wait until other stuff has finished. * need to wait until other stuff has finished.
*/ */
...@@ -3481,6 +3475,11 @@ int lxc_setup(struct lxc_handler *handler) ...@@ -3481,6 +3475,11 @@ int lxc_setup(struct lxc_handler *handler)
return log_error(-1, "Failed to setup mount entries"); return log_error(-1, "Failed to setup mount entries");
} }
lxc_conf->rootfs.dfd_dev = open_at(lxc_conf->rootfs.dfd_mnt, "dev",
PROTECT_OPATH_DIRECTORY, PROTECT_LOOKUP_BENEATH_XDEV, 0);
if (lxc_conf->rootfs.dfd_dev < 0 && errno != ENOENT)
return log_error_errno(-errno, errno, "Failed to open \"/dev\"");
if (lxc_conf->is_execute) { if (lxc_conf->is_execute) {
if (execveat_supported()) { if (execveat_supported()) {
int fd; int fd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment