comparison toys/chroot.c @ 193:0efba0e70c43

Other chroots fall back to "/bin/sh -i", so add the -i.
author Rob Landley <rob@landley.net>
date Mon, 03 Dec 2007 20:05:14 -0600
parents 7f55c59f5122
children d4176f3f3835
comparison
equal deleted inserted replaced
192:8c0809cee2b0 193:0efba0e70c43
1 /* vi: set sw=4 ts=4: */ 1 /* vi: set sw=4 ts=4: */
2 /* 2 /*
3 * chroot.c - Run command in new root directory. 3 * chroot.c - Run command in new root directory.
4 *
5 * Not in SUSv3.
4 */ 6 */
5 7
6 #include "toys.h" 8 #include "toys.h"
7 9
8 void chroot_main(void) 10 void chroot_main(void)
9 { 11 {
10 char *binsh[] = {"/bin/sh", 0}; 12 char *binsh[] = {"/bin/sh", "-i", 0};
11 if (chdir(*toys.optargs) || chroot(".")) 13 if (chdir(*toys.optargs) || chroot("."))
12 perror_exit("%s", *toys.optargs); 14 perror_exit("%s", *toys.optargs);
13 xexec(toys.optargs[1] ? toys.optargs+1 : binsh); 15 xexec(toys.optargs[1] ? toys.optargs+1 : binsh);
14 } 16 }