diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2005-11-15 03:15:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2005-11-15 03:15:30 +0000 |
commit | 6fce3b37edc744b1f3a2d2bd374c7f4d91075bb1 (patch) | |
tree | dbc180533bab090067d7c223c5e9ab6bf345cf2b /usr.sbin | |
parent | cc6fc1945b4060b760c4f619925a653b871135e9 (diff) |
If two or more changes are made withing a single second it is possible
that only the first change will be loaded due to the granularity of
st_mtime. Work around this by zeroing the saved mtime when we get
a poke on the socket from crontab or at since that means there has been
a change. Fix from Daniel Lucq.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/cron/cron.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c index 34fb46ab0aa..cc729efbeef 100644 --- a/usr.sbin/cron/cron.c +++ b/usr.sbin/cron/cron.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cron.c,v 1.36 2004/06/17 22:11:55 millert Exp $ */ +/* $OpenBSD: cron.c,v 1.37 2005/11/15 03:15:29 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -22,7 +22,7 @@ */ #if !defined(lint) && !defined(LINT) -static const char rcsid[] = "$OpenBSD: cron.c,v 1.36 2004/06/17 22:11:55 millert Exp $"; +static const char rcsid[] = "$OpenBSD: cron.c,v 1.37 2005/11/15 03:15:29 millert Exp $"; #endif #define MAIN_PROGRAM @@ -416,8 +416,10 @@ cron_sleep(int target) { if (fd >= 0 && fcntl(fd, F_SETFL, O_NONBLOCK) == 0) { (void) read(fd, &poke, 1); close(fd); - if (poke & RELOAD_CRON) + if (poke & RELOAD_CRON) { + database.mtime = (time_t)0; load_database(&database); + } if (poke & RELOAD_AT) { /* * We run any pending at jobs right @@ -425,6 +427,7 @@ cron_sleep(int target) { * jobs immediately. */ gettimeofday(&t2, NULL); + at_database.mtime = (time_t)0; if (scan_atjobs(&at_database, &t2)) atrun(&at_database, batch_maxload, t2.tv_sec); |