From 21016ea2497f17bcab8920fee9c84a22c3b5a1df Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Wed, 9 Mar 2011 08:37:38 +0100 Subject: [PATCH] Safeguard for system time changes. Otherwise anacron might wait with the job running for a too long time. --- anacron/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/anacron/main.c b/anacron/main.c index 08db810..c1a97e9 100644 --- a/anacron/main.c +++ b/anacron/main.c @@ -384,6 +384,12 @@ time_till(job_rec *jr) tn = time(NULL); tj = start_sec + jr->delay * 60; if (tj < tn) return 0; + if (tj - tn > 3600*24) + { + explain("System time manipulation detected, job `%s' will run immediately", + jr->ident); + return 0; + } return tj - tn; } -- 2.40.0