diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2015-08-25 20:09:28 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2015-08-25 20:09:28 +0000 |
commit | 519483eac8104c85e00286fcf1fc196d852f68c2 (patch) | |
tree | ee57dc1626896c57a909e60669a118fe0df2f414 /usr.sbin/cron/atrun.c | |
parent | 585254a8e1745efcb2cd0b199ba4f8754571bae1 (diff) |
Use ppoll(2) instead of poll(2). This has two benefits. Firstly,
we can use struct timespec throughout and avoid any conversion
issues which might cause jobs to fire prematurely. Secondly, it
eliminates a race condition that could delay us taking action on
SIGCHLD and SIGHUP. OK deraadt@ okan@ ratchov@
Diffstat (limited to 'usr.sbin/cron/atrun.c')
-rw-r--r-- | usr.sbin/cron/atrun.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c index a6dbb9a784a..efcd73e1df5 100644 --- a/usr.sbin/cron/atrun.c +++ b/usr.sbin/cron/atrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atrun.c,v 1.28 2015/02/09 23:00:14 deraadt Exp $ */ +/* $OpenBSD: atrun.c,v 1.29 2015/08/25 20:09:27 millert Exp $ */ /* * Copyright (c) 2002-2003 Todd C. Miller <Todd.Miller@courtesan.com> @@ -31,7 +31,7 @@ static void run_job(atjob *, char *); * Scan the at jobs dir and build up a list of jobs found. */ int -scan_atjobs(at_db *old_db, struct timeval *tv) +scan_atjobs(at_db *old_db, struct timespec *ts) { DIR *atdir = NULL; int cwd, queue, pending; @@ -110,7 +110,7 @@ scan_atjobs(at_db *old_db, struct timeval *tv) if (new_db.tail != NULL) new_db.tail->next = job; new_db.tail = job; - if (tv != NULL && run_time <= tv->tv_sec) + if (ts != NULL && run_time <= ts->tv_sec) pending = 1; } closedir(atdir); |