repo.or.cz
/
minix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
secondary cache feature in vm.
[minix.git]
/
commands
/
simple
/
chroot.c
blob
f9758de4f13bf66f12d086003874308af7adbf93
1
2
#include <unistd.h>
3
#include <stdio.h>
4
#include <stdlib.h>
5
6
#include <sys/wait.h>
7
8
int
9
main
(
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