X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Ftests%2Fescaperoot.c;h=3b1925fec09d72801eadf0ac9e9f2072973ae604;hb=3eb1b2279739d0f16391a3724a9897c686f030d3;hp=4a6443382fe10143c48902cc85efc383792a10d8;hpb=865ce0e73c58457aa139424d52d8e096270be104;p=util-vserver.git diff --git a/util-vserver/tests/escaperoot.c b/util-vserver/tests/escaperoot.c index 4a64433..3b1925f 100644 --- a/util-vserver/tests/escaperoot.c +++ b/util-vserver/tests/escaperoot.c @@ -51,8 +51,9 @@ static void test1() if (chroot ("dummy_dir")==-1){ fprintf (stderr,"Can't chroot into dummy_dir (%s)\n",strerror(errno)); }else{ + int i; // Try to chdir into the real root - for (int i=0; i<1000; i++) chdir(".."); + for (i=0; i<1000; i++) chdir(".."); print_pwd(); if (execl ("/bin/sh","/bin/sh",NULL)==-1){ fprintf (stderr,"execl /bin/sh failed (%s)\n",strerror(errno)); @@ -66,10 +67,12 @@ static void test1() */ static void test2() { + int fd; + printf ("test2\n"); print_pwd(); mkdir ("dummy_dir",0755); - int fd = open (".",O_RDONLY); + fd = open (".",O_RDONLY); if (fd == -1){ fprintf (stderr,"Can't open current directory (%s)\n",strerror(errno)); }else if (chroot ("dummy_dir")==-1){ @@ -78,8 +81,9 @@ static void test2() fprintf (stderr,"Can't fchdir to the current directory (%s)\n" ,strerror(errno)); }else{ + int i; // Try to chdir into the real root - for (int i=0; i<1000; i++) chdir(".."); + for (i=0; i<1000; i++) chdir(".."); print_pwd(); if (execl ("/bin/sh","/bin/sh",NULL)==-1){ fprintf (stderr,"execl /bin/sh failed (%s)\n",strerror(errno));