From: John Ferlito Date: Sat, 1 Apr 2017 23:20:33 +0000 (+1000) Subject: killall - Fix race condition for --older-than and --younger-than X-Git-Tag: v23.0~3^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ada030124b00e3fb91c72465bdec87e6cc7d502a;p=psmisc 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. --- 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;