// 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.