summaryrefslogtreecommitdiff
path: root/src/core/switch-root.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-13 15:27:04 +0200
committerLennart Poettering <lennart@poettering.net>2012-08-13 15:27:04 +0200
commitac0930c892bc7979b4c9bc2a52e5e844650b025d (patch)
treef0388a829e7b827e0797fe5fab5ae50f79a6afcd /src/core/switch-root.c
parent6f67a45d8e61d69bf4f75e1da3edcf9fe7d89982 (diff)
namespace: rework namespace support
- don't use pivot_root() anymore, just reuse root hierarchy - first create all mounts, then mark them read-only so that we get the right behaviour when people want writable mounts inside of read-only mounts - don't pass invalid combinations of MS_ constants to the kernel
Diffstat (limited to 'src/core/switch-root.c')
-rw-r--r--src/core/switch-root.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/switch-root.c b/src/core/switch-root.c
index efc7d345e1..150332a858 100644
--- a/src/core/switch-root.c
+++ b/src/core/switch-root.c
@@ -115,6 +115,12 @@ int switch_root(const char *new_root) {
goto fail;
}
+ if (chdir("/") < 0) {
+ r = -errno;
+ log_error("Failed to change directory: %m");
+ goto fail;
+ }
+
if (old_root_fd >= 0) {
struct stat rb;