Make cin be static
[oweals/busybox.git] / chroot.c
index 9b1a5a82d82dbd434efafb8bb43fb69c110e69c8..91d3407f2a37f6a5ee7e0470d68880af3be667da 100644 (file)
--- a/chroot.c
+++ b/chroot.c
@@ -22,7 +22,7 @@
  *
  */
 
-#include "internal.h"
+#include "busybox.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
@@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv)
        argv++;
 
        if (chroot(*argv) || (chdir("/"))) {
-               fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
+               perror_msg_and_die("cannot change root directory to %s", *argv);
        }
 
        argc--;
@@ -47,12 +47,17 @@ int chroot_main(int argc, char **argv)
                prog = *argv;
                execvp(*argv, argv);
        } else {
+#ifndef BB_SH
                prog = getenv("SHELL");
                if (!prog)
                        prog = "/bin/sh";
                execlp(prog, prog, NULL);
+#else
+               shell_main(argc, argv);
+               return EXIT_SUCCESS;
+#endif
        }
-       fatalError("cannot execute %s: %s\n", prog, strerror(errno));
+       perror_msg_and_die("cannot execute %s", prog);
 
 }