mirror of
https://github.com/systemd/systemd.git
synced 2025-03-29 06:50:16 +03:00
namespace: don't make the root directory of a namespace a mount if it already is one
Let's not stack mounts needlessly.
This commit is contained in:
parent
d944dc9553
commit
8f1ad200f0
@ -650,10 +650,15 @@ int setup_namespace(
|
||||
}
|
||||
|
||||
if (root_directory) {
|
||||
/* Turn directory into bind mount */
|
||||
if (mount(root_directory, root_directory, NULL, MS_BIND|MS_REC, NULL) < 0) {
|
||||
r = -errno;
|
||||
/* Turn directory into bind mount, if it isn't one yet */
|
||||
r = path_is_mount_point(root_directory, AT_SYMLINK_FOLLOW);
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
if (r == 0) {
|
||||
if (mount(root_directory, root_directory, NULL, MS_BIND|MS_REC, NULL) < 0) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user