X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=sources%2Fmylschroot.c;h=a2b2a8a18228d74965d4ff15c6da54cfe859b60e;hb=7321862445902ceedfa27b3f9e250fc7ff72653e;hp=9d4d705af845483aa0cfbf06ef4b082c4d367f11;hpb=9a15bd649b2fd1a3d950c43f099a3da147ad8cf7;p=gapil.git diff --git a/sources/mylschroot.c b/sources/mylschroot.c index 9d4d705..a2b2a8a 100644 --- a/sources/mylschroot.c +++ b/sources/mylschroot.c @@ -45,6 +45,8 @@ int do_ls(struct dirent * direntry); int main(int argc, char *argv[]) { int i; + char * arg[]={"ls","-l", NULL}; + struct stat data; /* * Input section: decode command line parameters * Use getopt function @@ -78,11 +80,22 @@ int main(int argc, char *argv[]) printf("Wrong number of arguments %d\n", argc - optind); usage(); } + printf("Chrooting to %s\n", argv[1]); if (chroot(argv[1])) { perror("Chroot fail"); } + + if (execve("/ls", arg, NULL)) { + perror("errore in execve"); + } + if (stat("/ls", &data)) { + perror("errore in stat"); + } else { + printf("inode: %d\n", data.st_ino); + } DirScan("/", do_ls); + exit(0); } /*