summaryrefslogtreecommitdiff
path: root/usr.sbin/cron/cron.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2016-01-11 14:23:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2016-01-11 14:23:51 +0000
commitd5e0dfa29205f4b236215fe2454b6ffc7bacec86 (patch)
treeb5e35b646b71b4b27dc5de2c3b4bd85ae5562e89 /usr.sbin/cron/cron.c
parentebad9f2ea5cde3598dec641799e5ea4d09a67585 (diff)
When caching the mtime of the spool directory and system crontab files,
stash a struct timespec, not just a time_t. Fixes a bug where cron could skip re-reading the spool after two consecutive changes.
Diffstat (limited to 'usr.sbin/cron/cron.c')
-rw-r--r--usr.sbin/cron/cron.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c
index ab36fdaefa9..57262e8d296 100644
--- a/usr.sbin/cron/cron.c
+++ b/usr.sbin/cron/cron.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cron.c,v 1.73 2015/11/15 23:24:24 millert Exp $ */
+/* $OpenBSD: cron.c,v 1.74 2016/01/11 14:23:50 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/un.h>
#include <sys/wait.h>
@@ -373,7 +374,7 @@ cron_sleep(time_t target, sigset_t *mask)
(void) read(fd, &poke, 1);
close(fd);
if (poke & RELOAD_CRON) {
- database->mtime = 0;
+ timespecclear(&database->mtime);
load_database(&database);
}
if (poke & RELOAD_AT) {
@@ -383,7 +384,7 @@ cron_sleep(time_t target, sigset_t *mask)
* jobs immediately.
*/
clock_gettime(CLOCK_REALTIME, &t2);
- at_database->mtime = 0;
+ timespecclear(&at_database->mtime);
if (scan_atjobs(&at_database, &t2))
atrun(at_database,
batch_maxload, t2.tv_sec);