+ args[3] = 0;
+ if (argn + 1 <= ac) {
+ args[2] = av[argn+1];
+ }
+ if (rootdir) {
+ if (chdir(rootdir) == -1) {
+ perror("can not chdir to rootdir");
+ exit(EXIT_FAILURE);
+ }
+ if (geteuid() == 0) {
+ /* chroot is deprecated, and not in
+ * posix. need to use OS/kernel
+ * specific code.
+ */
+ fprintf(stderr, "support for chroot equivalent not supported on this OS\n");
+ } else {
+ fprintf(stderr, "unable to chroot as non root use\n");
+ }
+ } else {
+ if (chdir("/") == -1) {
+ perror("can not chdir to /");
+ exit(EXIT_FAILURE);
+ }