scron

simple cron daemon
git clone git://git.2f30.org/scron
Log | Files | Refs | README | LICENSE

commit 283b23c892feba290a8e0c7a1995119cb53a1074
parent 2cc04f743887bb93253e002827ba90a0378220ba
Author: Ari Malinen <ari.malinen@gmail.com>
Date:   Wed, 23 Jul 2014 14:33:59 +0300

Handle .tm=0 case in matchentry()

Diffstat:
Mcrond.c | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/crond.c b/crond.c @@ -210,19 +210,19 @@ matchentry(struct ctabentry *cte, struct tm *tm) size_t i; for (i = 0; i < LEN(matchtbl); i++) { - /* this is the match-any case, '*' */ - if (matchtbl[i].f->low == -1 && matchtbl[i].f->high == -1) - continue; - if (matchtbl[i].f->div > 0) - if (matchtbl[i].tm % matchtbl[i].f->div == 0) - continue; if (matchtbl[i].f->high == -1) { - if (matchtbl[i].f->low == matchtbl[i].tm) + if (matchtbl[i].f->low == -1) { continue; - } else { - if (matchtbl[i].f->low <= matchtbl[i].tm && - matchtbl[i].f->high >= matchtbl[i].tm) + } else if (matchtbl[i].f->div > 0) { + if (matchtbl[i].tm > 0 || matchtbl[i].f->div % 2 == 0) + if (matchtbl[i].tm % matchtbl[i].f->div == 0) + continue; + } else if (matchtbl[i].f->low == matchtbl[i].tm) { continue; + } + } else if (matchtbl[i].f->low <= matchtbl[i].tm && + matchtbl[i].f->high >= matchtbl[i].tm) { + continue; } break; }