From ada030124b00e3fb91c72465bdec87e6cc7d502a Mon Sep 17 00:00:00 2001 From: John Ferlito Date: Sun, 2 Apr 2017 09:20:33 +1000 Subject: [PATCH] killall - Fix race condition for --older-than and --younger-than If killall runs really quickly then it' possible for process_age to be 0.0. The existing logic will then always kill the process due t "&& process_age" always being false in that case. --- src/killall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/killall.c b/src/killall.c index a2fcabd..1826362 100644 --- a/src/killall.c +++ b/src/killall.c @@ -518,9 +518,9 @@ kill_all (int signal, int name_count, char **namelist, struct passwd *pwent) continue; /* test for process age, if required */ - if ( younger_than && process_age_sec && (process_age_sec > younger_than ) ) + if ( younger_than && (process_age_sec > younger_than ) ) continue; - if ( older_than && process_age_sec && (process_age_sec < older_than ) ) + if ( older_than && (process_age_sec < older_than ) ) continue; got_long = 0; -- 2.40.0