[Forensics-changes] [SCM] Forensics related utilities branch, debian, updated. debian/1.18-2-3-g33d2a09
Daniel Baumann
daniel at debian.org
Thu May 28 21:00:38 UTC 2009
The following commit has been merged in the debian branch:
commit 33d2a0975c3fad88f4ca9a5b67b498f63d6722d1
Author: Daniel Baumann <daniel at debian.org>
Date: Thu May 28 22:52:48 2009 +0200
Adding patch from Sami Liedes <sliedes at cc.hut.fi> to add support for fractions of seconds for timeout (Closes: #412923).
diff --git a/debian/patches/02-seconds.patch b/debian/patches/02-seconds.patch
new file mode 100644
index 0000000..5204f7f
--- /dev/null
+++ b/debian/patches/02-seconds.patch
@@ -0,0 +1,53 @@
+Author: Sami Liedes <sliedes at cc.hut.fi>
+Description:
+ Adding support for fractions of seconds for timeout (Closes: #412923).
+
+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
++++ tct/src/misc/timeout.c 2009-05-28 20:48:29.000000000 +0000
+@@ -39,6 +39,8 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <stdio.h>
++#include <time.h>
++#include <sys/wait.h>
+
+ extern int optind;
+
+@@ -69,10 +71,11 @@ int main(argc, argv)
+ int argc;
+ char **argv;
+ {
+- int time_to_run;
++ float time_to_run;
+ pid_t pid;
+ pid_t child_pid;
+ int status;
++ struct timespec ts;
+
+ progname = argv[0];
+
+@@ -83,7 +86,7 @@ char **argv;
+ if ((kill_signal = atoi(*argv + 1)) <= 0)
+ usage();
+
+- if (argc < 2 || (time_to_run = atoi(argv[0])) <= 0)
++ if (argc < 2 || (time_to_run = atof(argv[0])) <= 0)
+ usage();
+
+ commandname = argv[1];
+@@ -105,7 +108,13 @@ 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);
++ }
+ while ((pid = wait(&status)) != -1 && pid != child_pid)
+ /* void */ ;
+ return (pid == child_pid ? WEXITSTATUS(status) | WTERMSIG(status) : -1);
diff --git a/debian/patches/series b/debian/patches/series
index a710074..5823c1b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
01-conglomeration.patch
+02-seconds.patch
--
Forensics related utilities
More information about the forensics-changes
mailing list