summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/switch_root.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index bd1e9d5..3a17411 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -105,8 +105,9 @@ int switch_root_main(int argc, char **argv)
// Overmount / with newdir and chroot into it. The chdir is needed to
// recalculate "." and ".." links.
- if (mount(".", "/", NULL, MS_MOVE, NULL) || chroot("."))
+ if (mount(".", "/", NULL, MS_MOVE, NULL))
bb_error_msg_and_die("error moving root");
+ xchroot(".");
xchdir("/");
// If a new console specified, redirect stdin/stdout/stderr to that.