Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/utils/chroot.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 362 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 /*
2 * by rmk
3 */
4 #include <unistd.h>
5 #include <stdio.h>
6
7 int main(int argc, char *argv[], char *envp[])
8 {
9 if (argc < 3) {
10 fprintf(stderr, "Usage: %s newroot command...\n", argv[0]);
11 return 1;
12 }
13
14 if (chroot(argv[1]) == -1) {
15 perror("chroot");
16 return 1;
17 }
18
19 if (execve(argv[2], argv + 2, envp) == -1) {
20 perror("execve");
21 return 1;
22 }
23
24 return 0;
25 }