blob: 0126d968aaf021011a63c5db0a3f508a69c3ad40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
/* vi: set sw=4 ts=4: */
/*
* chroot.c - Run command in new root directory.
*/
#include "toys.h"
void chroot_main(void)
{
char *binsh[] = {"/bin/sh", 0};
if (chdir(*toys.optargs) || chroot("."))
perror_exit("%s", *toys.optargs);
xexec(toys.optargs[1] ? toys.optargs+1 : binsh);
}
|