The last(1) choked if there were two successive "login" marks

found in wtmp(5) for the same TTY without in-between "logout"
mark.

This may be demonstrated by executing login(1), logging in and
out, and watching the last(1) output on this TTY:

: # last -tv7 -w
: ru      ttyv7              Mon May 28 12:46 - 12:46  (00:00:01)
: ru      ttyv7              Mon May 28 12:45   still logged in

The fix merely takes the second "login" mark as the "logout" for
the first "login" mark, if there were no "logout" mark in-between.
This restores the behavior of last.c,v 1.2:

: # last -tv7 -w
: ru      ttyv7              Mon May 28 12:46 - 12:46  (00:00:01)
: ru      ttyv7              Mon May 28 12:45 - 12:46  (00:00:25)

Silence from:	-arch, dg
This commit is contained in:
Ruslan Ermilov 2001-05-28 09:57:19 +00:00
parent dfbe5c12ae
commit f82078861c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77328

View File

@ -352,13 +352,10 @@ wtmp()
delta / 86400, ct);
}
}
LIST_REMOVE(tt, list);
free(tt);
if (maxrec != -1 && !--maxrec)
return;
} else {
tt->logout = bp->ut_time;
}
tt->logout = bp->ut_time;
}
}
tm = localtime(&buf[0].ut_time);