From 81d64f4023ac8ef3b9e3fa3315c4e6c81bd6a85d Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 26 Dec 2003 00:48:26 +0000 Subject: [PATCH] used workarounds to make it compilable with non-C99 compilers git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@495 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/tests/escaperoot.c | 6 ++++-- util-vserver/tests/forkbomb.c | 8 +++++--- util-vserver/tests/testlimit.c | 3 ++- util-vserver/tests/testopenf.c | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/util-vserver/tests/escaperoot.c b/util-vserver/tests/escaperoot.c index 4a64433..1e56544 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)); @@ -78,8 +79,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)); diff --git a/util-vserver/tests/forkbomb.c b/util-vserver/tests/forkbomb.c index af18b3f..61b5a8e 100644 --- a/util-vserver/tests/forkbomb.c +++ b/util-vserver/tests/forkbomb.c @@ -64,7 +64,8 @@ int main (int argc, char *argv[]) " exits, then the parent start a new one\n" ); }else{ - MODE mode; + MODE mode; + int i; if (strcmp(argv[3],"sleep")==0){ mode = MODE_SLEEP; }else if (strcmp(argv[3],"loop")==0){ @@ -77,13 +78,14 @@ int main (int argc, char *argv[]) fprintf (stderr,"Invalid mode\n"); exit (-1); } - for (int i=0; i