diff options
author | 2002-05-20 23:33:31 +0000 | |
---|---|---|
committer | 2002-05-20 23:33:31 +0000 | |
commit | ba45d2116dc8de2bc989ee7e01286c86ee130f88 (patch) | |
tree | 31aac77167a721935b7305cfc4e4029b7f223c4f | |
parent | Do not blindly call wsdisplay routines if no wsdisplay device is active (diff) | |
download | wireguard-openbsd-ba45d2116dc8de2bc989ee7e01286c86ee130f88.tar.xz wireguard-openbsd-ba45d2116dc8de2bc989ee7e01286c86ee130f88.zip |
Add a check for negative values in struct timeval after the timersub().
Just treat it like a zero value. Also check for errno != EINTR
when select() returns -1.
-rw-r--r-- | usr.sbin/cron/cron.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c index d7a9febf5bb..f029193ce56 100644 --- a/usr.sbin/cron/cron.c +++ b/usr.sbin/cron/cron.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cron.c,v 1.20 2002/05/09 21:22:01 millert Exp $ */ +/* $OpenBSD: cron.c,v 1.21 2002/05/20 23:33:31 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved */ @@ -21,7 +21,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$OpenBSD: cron.c,v 1.20 2002/05/09 21:22:01 millert Exp $"; +static char rcsid[] = "$OpenBSD: cron.c,v 1.21 2002/05/20 23:33:31 millert Exp $"; #endif #define MAIN_PROGRAM @@ -362,13 +362,15 @@ cron_sleep(int target) { sizeof(fd_mask)); } - while (timerisset(&tv) && tv.tv_sec < 65) { + while ((tv.tv_sec > 0 || tv.tv_usec > 0) && tv.tv_sec < 65) { if (fdsr) FD_SET(cronSock, fdsr); /* Sleep until we time out, get a crontab poke, or signal. */ nfds = select(cronSock + 1, fdsr, NULL, NULL, &tv); if (nfds == 0) break; /* timer expired */ + if (nfds == -1 && errno != EINTR) + break; /* an error occurred */ if (nfds > 0) { Debug(DSCH, ("[%ld] Got a poke on the socket\n", (long)getpid())) |