source: trunk/minix/commands/simple/chroot.c@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 383 bytes
RevLine 
[9]1
2#include <unistd.h>
3#include <stdio.h>
4#include <stdlib.h>
5
6#include <sys/wait.h>
7
8int
9main(int argc, char *argv[])
10{
11 int status;
12
13 if(argc != 3) {
14 fprintf(stderr, "usage: %s <root> <command>\n", argv[0]);
15 return 1;
16 }
17
18 if(chroot(argv[1]) < 0) {
19 perror("chroot");
20 return 1;
21 }
22
23 status = system(argv[2]);
24 if(WIFEXITED(status))
25 return WEXITSTATUS(status);
26 return 1;
27}
28
Note: See TracBrowser for help on using the repository browser.