diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-07-20 19:39:36 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-07-20 19:39:36 +0000 |
commit | 5b07ddb2000d2e9c17d4a218dd0fa22034a5df8b (patch) | |
tree | e205f7454114336ed2726118c9a2551d8f375bfb /usr.sbin/ac | |
parent | 08e650ea2bf94699d9581cd5ee6be577fa6bc387 (diff) |
ignore backwards going entries
Diffstat (limited to 'usr.sbin/ac')
-rw-r--r-- | usr.sbin/ac/ac.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c index a80df95c4e6..03e6ded4988 100644 --- a/usr.sbin/ac/ac.c +++ b/usr.sbin/ac/ac.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: ac.c,v 1.14 2003/06/11 23:33:24 deraadt Exp $"; +static char rcsid[] = "$Id: ac.c,v 1.15 2003/07/20 19:39:35 mickey Exp $"; #endif #include <sys/types.h> @@ -439,12 +439,15 @@ ac(FILE *fp) struct utmp_list *lp, *head = NULL; struct utmp usr; struct tm *ltm; - time_t secs = 0; + time_t secs = 0, prev = 0; int day = -1; while (fread((char *)&usr, sizeof(usr), 1, fp) == 1) { if (!FirstTime) FirstTime = usr.ut_time; + if (usr.ut_time < prev) + continue; /* broken record */ + prev = usr.ut_time; if (Flags & AC_D) { ltm = localtime(&usr.ut_time); if (day >= 0 && day != ltm->tm_yday) { |