From 149d4c2eb3bdffe1f7b4157fbedcd4bfa986b104 Mon Sep 17 00:00:00 2001 From: "K. Noel Belcourt" Date: Sat, 29 Sep 2007 20:23:29 +0000 Subject: [PATCH] When terminating unix processes I forgot to check for negative time differences. This patch only sets the select timeout if the difference between the requested and consumed time is positive. [SVN r39612] --- src/engine/execunix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine/execunix.c b/src/engine/execunix.c index 17880cd91..61925b715 100644 --- a/src/engine/execunix.c +++ b/src/engine/execunix.c @@ -380,7 +380,9 @@ void populate_file_descriptors(int *fmax, fd_set *fds) if (globs.timeout && cmdtab[i].pid) { clock_t consumed = (current - cmdtab[i].start_time) / tps; - timeout = (globs.timeout - consumed) < timeout ? (globs.timeout - consumed) : timeout; + if (0 <= (globs.timeout - consumed) && ((globs.timeout - consumed) < timeout)) { + timeout = globs.timeout - consumed; + } if (globs.timeout <= consumed) { killpg(cmdtab[i].pid, SIGKILL); cmdtab[i].exit_reason = EXIT_TIMEOUT;