diff options
author | Erik Andersen | 2000-02-08 19:58:47 +0000 |
---|---|---|
committer | Erik Andersen | 2000-02-08 19:58:47 +0000 |
commit | e49d5ecbbe51718fa925b6890a735e5937cc2aa2 (patch) | |
tree | c90bda10731ad9333ce3b404f993354c9fc104b8 /coreutils/chroot.c | |
parent | c0bf817bbc5c7867fbe8fb76d5c39f8ee802692f (diff) | |
download | busybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.zip busybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.tar.gz |
Some formatting updates (ran the code through indent)
-Erik
Diffstat (limited to 'coreutils/chroot.c')
-rw-r--r-- | coreutils/chroot.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index 16524d9..6a01be6 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* * Mini chroot implementation for busybox * @@ -28,39 +29,39 @@ static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n" -"Run COMMAND with root directory set to NEWROOT.\n"; + + "Run COMMAND with root directory set to NEWROOT.\n"; int chroot_main(int argc, char **argv) { - if ( (argc < 2) || (**(argv+1) == '-') ) { - usage( chroot_usage); - } - argc--; - argv++; + if ((argc < 2) || (**(argv + 1) == '-')) { + usage(chroot_usage); + } + argc--; + argv++; - if (chroot (*argv) || (chdir ("/"))) { - fprintf(stderr, "chroot: cannot change root directory to %s: %s\n", - *argv, strerror(errno)); - exit( FALSE); - } + if (chroot(*argv) || (chdir("/"))) { + fprintf(stderr, "chroot: cannot change root directory to %s: %s\n", + *argv, strerror(errno)); + exit(FALSE); + } - argc--; - argv++; - if (argc >= 1) { - fprintf(stderr, "command: %s\n", *argv); - execvp (*argv, argv); - } - else { - char *prog; - prog = getenv ("SHELL"); - if (!prog) - prog = "/bin/sh"; - execlp (prog, prog, NULL); - } - fprintf(stderr, "chroot: cannot execute %s: %s\n", - *argv, strerror(errno)); - exit( FALSE); -} + argc--; + argv++; + if (argc >= 1) { + fprintf(stderr, "command: %s\n", *argv); + execvp(*argv, argv); + } else { + char *prog; + prog = getenv("SHELL"); + if (!prog) + prog = "/bin/sh"; + execlp(prog, prog, NULL); + } + fprintf(stderr, "chroot: cannot execute %s: %s\n", + *argv, strerror(errno)); + exit(FALSE); +} |