[Forensics-changes] [SCM] debian-forensics/tct branch, debian, updated. debian/1.18-4-7-g9894fa3

Michael Prokop mika at debian.org
Tue Sep 29 21:50:47 UTC 2009


The following commit has been merged in the debian branch:
commit 2cb841fbff8dec58b67da8a9847d976b445b4259
Author: Michael Prokop <mika at debian.org>
Date:   Tue Sep 29 22:39:00 2009 +0200

    Update debian/patches/02-seconds.patch. Closes #532342

diff --git a/debian/patches/02-seconds.patch b/debian/patches/02-seconds.patch
index 5204f7f..e6644c5 100644
--- a/debian/patches/02-seconds.patch
+++ b/debian/patches/02-seconds.patch
@@ -1,6 +1,7 @@
-Author: Sami Liedes <sliedes at cc.hut.fi>
+Author: Sami Liedes <sliedes at cc.hut.fi> + Aron Griffis <agriffis at n01se.net>
 Description:
  Adding support for fractions of seconds for timeout (Closes: #412923).
+ Fix "does not exit until timeout when launched in a cgi" (Closes: #532342).
 
 diff -Naurp tct.orig/src/misc/timeout.c tct/src/misc/timeout.c
 --- tct.orig/src/misc/timeout.c	2009-05-28 19:05:34.000000000 +0000
@@ -9,7 +10,7 @@ diff -Naurp tct.orig/src/misc/timeout.c tct/src/misc/timeout.c
  #include <stdlib.h>
  #include <unistd.h>
  #include <stdio.h>
-+#include <time.h>
++#include <sys/time.h>
 +#include <sys/wait.h>
  
  extern int optind;
@@ -19,11 +20,11 @@ diff -Naurp tct.orig/src/misc/timeout.c tct/src/misc/timeout.c
  char  **argv;
  {
 -    int     time_to_run;
-+    float   time_to_run;
++    double  time_to_run;
      pid_t   pid;
      pid_t   child_pid;
      int     status;
-+    struct  timespec ts;
++    struct  itimerval itv;
  
      progname = argv[0];
  
@@ -36,18 +37,16 @@ diff -Naurp tct.orig/src/misc/timeout.c tct/src/misc/timeout.c
  	usage();
  
      commandname = argv[1];
-@@ -105,7 +108,13 @@ char  **argv;
+@@ -105,7 +108,11 @@ char  **argv;
  	(void) signal(SIGQUIT, terminate);
  	(void) signal(SIGTERM, terminate);
  	(void) signal(SIGALRM, terminate);
 -	alarm(time_to_run);
-+	if (!fork()) {
-+	    ts.tv_sec = (int)time_to_run;
-+	    ts.tv_nsec = (time_to_run-ts.tv_sec)*1000000000;
-+	    nanosleep(&ts,NULL);
-+	    kill(getppid(),SIGALRM);
-+	    exit(0);
-+	}
++	itv.it_value.tv_sec = (long)time_to_run;
++	itv.it_value.tv_usec = (time_to_run-itv.it_value.tv_sec)*1000000;
++	itv.it_interval.tv_sec = 0;
++	itv.it_interval.tv_usec = 0;
++	(void) setitimer(ITIMER_REAL, &itv, NULL);
  	while ((pid = wait(&status)) != -1 && pid != child_pid)
  	     /* void */ ;
  	return (pid == child_pid ? WEXITSTATUS(status) | WTERMSIG(status) : -1);

-- 
debian-forensics/tct



More information about the forensics-changes mailing list