1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00

namespace: set up OS hierarchy only after mounting the new root, not before

Otherwise it's a pointless excercise, as we'll set up an empty directory
tree that's never going to be used.

Hence, let's move this around a bit, so that we do the basesystem
initialization exactly when RootImage= or RootDirectory= are used, but
not otherwise.
This commit is contained in:
Lennart Poettering 2017-11-08 18:35:16 +01:00
parent 521cdf01e4
commit 4e0c20de97

View File

@ -1152,10 +1152,6 @@ int setup_namespace(
}
}
/* Try to set up the new root directory before mounting anything there */
if (root)
(void) base_filesystem_create(root, UID_INVALID, GID_INVALID);
if (root_image) {
/* A root image is specified, mount it to the right place */
r = dissected_image_mount(dissected_image, root, dissect_image_flags);
@ -1192,6 +1188,10 @@ int setup_namespace(
}
}
/* Try to set up the new root directory before mounting anything else there. */
if (root_image || root_directory)
(void) base_filesystem_create(root, UID_INVALID, GID_INVALID);
if (n_mounts > 0) {
_cleanup_fclose_ FILE *proc_self_mountinfo = NULL;
char **blacklist;