]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix none/tests/pth_2sig.c build with (default) -std=gnu90.
authorMark Wielaard <mark@klomp.org>
Mon, 21 Nov 2016 08:28:07 +0000 (08:28 +0000)
committerMark Wielaard <mark@klomp.org>
Mon, 21 Nov 2016 08:28:07 +0000 (08:28 +0000)
error: ‘for’ loop initial declarations are only allowed in C99 mode

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16148

none/tests/pth_2sig.c

index f296c75af477b74e767b70d86c893293ff1a473f..56e6904c0139a4bcb616e4e977fdaf04538d6086 100644 (file)
@@ -14,7 +14,8 @@ void *slavethread(void *arg)
 
 int main(int argc, char **argv)
 {
-    for (int i = 0; i < 10; i++) {
+    int i;
+    for (i = 0; i < 10; i++) {
         pthread_t slave;
         if (pthread_create(&slave, 0, slavethread, 0)) {
             perror("pthread_create");
@@ -26,7 +27,7 @@ int main(int argc, char **argv)
     switch (fork()) {
         case 0: // child
             sleep(2); // Should be enough to ensure (some) threads are created
-            for (int i = 0; i < 20 && kill(pid, SIGTERM) == 0; i++)
+            for (i = 0; i < 20 && kill(pid, SIGTERM) == 0; i++)
                 ;
             exit(0);
         case -1: