Mercurial > hg > toybox
view toys/chroot.c @ 214:98820d1eaa79
Upgrade patch to understand creating and deleting files.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 20 Dec 2007 06:30:19 -0600 |
parents | 0efba0e70c43 |
children | d4176f3f3835 |
line wrap: on
line source
/* vi: set sw=4 ts=4: */ /* * chroot.c - Run command in new root directory. * * Not in SUSv3. */ #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); }