summaryrefslogtreecommitdiff
path: root/usr.sbin/ac
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ac')
-rw-r--r--usr.sbin/ac/ac.c7
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) {