diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-05-20 23:33:32 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-05-20 23:33:32 +0000 |
commit | cb783cd9aea497feee89929c298e7f06e3775cb2 (patch) | |
tree | 4fea73e5deb5563eb2b73828881e45137ae87bea /usr.sbin | |
parent | 6439941f3d904910e7b59ed8d9fc5e499b0a4d6f (diff) |
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.
Diffstat (limited to 'usr.sbin')
-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())) |