(no commit message)
[oweals/gnunet.git] / contrib / timeout_watchdog.c
index 83f751fb0f18a16bcdbc785ef5cbc92925424d1b..9a1fc006d490db55c8fa96055c3d1ca8b18f7ecb 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -39,15 +39,15 @@ static void sigchld_handler(int val)
   int ret = 0;
   
   waitpid (child, &status, 0);
-  if (WIFEXITED(status) == 1)
+  if (WIFEXITED(status) != 0)
   {
     ret = WEXITSTATUS(status);
     printf("Test process exited with result %u\n", ret);
   }
-  if (WIFSIGNALED(status) == 1)
+  if (WIFSIGNALED(status) != 0)
   {
-    printf("Test process was signaled %u\n", WTERMSIG(status));
-    ret = WTERMSIG(status);
+       ret = WTERMSIG(status);
+       printf("Test process was signaled %u\n", ret);
   }   
   exit(ret);  
 }
@@ -97,7 +97,8 @@ if (child==0)
 if (child > 0)
 {
   sleep(timeout);
-  kill(0,SIGABRT);
+  printf("Child processes were killed after timeout of %u seconds\n",timeout);
+  kill(0,SIGTERM);
   exit(1);
 }  
 exit(1);