aboutsummaryrefslogtreecommitdiff
path: root/toys/other/chroot.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-11-13 17:14:08 -0600
committerRob Landley <rob@landley.net>2012-11-13 17:14:08 -0600
commit7aa651a6a4496d848f86de9b1e6b3a003256a01f (patch)
tree6995fb4b7cc2e90a6706b0239ebaf95d9dbab530 /toys/other/chroot.c
parent571b0706cce45716126776d0ad0f6ac65f4586e3 (diff)
downloadtoybox-7aa651a6a4496d848f86de9b1e6b3a003256a01f.tar.gz
Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
Diffstat (limited to 'toys/other/chroot.c')
-rw-r--r--toys/other/chroot.c21
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);
}