diff options
Diffstat (limited to 'toys/other/chroot.c')
-rw-r--r-- | toys/other/chroot.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/toys/other/chroot.c b/toys/other/chroot.c index 003ed072..c9ff10c7 100644 --- a/toys/other/chroot.c +++ b/toys/other/chroot.c @@ -1,26 +1,23 @@ -/* vi: set sw=4 ts=4: - * - * chroot.c - Run command in new root directory. +/* chroot.c - Run command in new root directory. * * Copyright 2007 Rob Landley <rob@landley.net> USE_CHROOT(NEWTOY(chroot, "^<1", TOYFLAG_USR|TOYFLAG_SBIN)) config CHROOT - bool "chroot" - default y - help - usage: chroot NEWPATH [commandline...] + bool "chroot" + default y + help + usage: chroot NEWPATH [commandline...] - Run command within a new root directory. If no command, run /bin/sh. + Run command within a new root directory. If no command, run /bin/sh. */ #include "toys.h" void chroot_main(void) { - char *binsh[] = {"/bin/sh", "-i", 0}; - if (chdir(*toys.optargs) || chroot(".")) - perror_exit("%s", *toys.optargs); - xexec(toys.optargs[1] ? toys.optargs+1 : binsh); + char *binsh[] = {"/bin/sh", "-i", 0}; + if (chdir(*toys.optargs) || chroot(".")) perror_exit("%s", *toys.optargs); + xexec(toys.optargs[1] ? toys.optargs+1 : binsh); } |