Bug in init.c

utzoo!decvax!ittvax!tpdcvax!bobvan utzoo!decvax!ittvax!tpdcvax!bobvan
Fri Oct 22 23:48:54 AEST 1982


I've just found the bug in init.c that prevents log out records from
being written to /usr/adm/wtmp when the system is shutdown.  The
symptoms are that users logged in at the time the shutdown occurred
appear logged out if you read /etc/utmp (with who(1)), but still appear
logged in if you read /usr/adm/wtmp (with last(1)).  The fix is to
delay the clearing of /etc/utmp until after all users have been
logged out.  The first five executable lines of function shutdown()
should be changed:

	/* used to read */		/* should read */

	close(creat(utmp, 0644));	signal(SIGHUP, SIG_IGN);
	signal(SIGHUP, SIG_IGN);	for(ALL) {
	for(ALL) {				term(p);
		term(p);			p->line[0] = 0;
		p->line[0] = 0;		}
	}				close(creat(utmp, 0644));

The statements are the same, only order of execution has changed
to protect the forgetful.

If you shut your system down regularly (as we do), you'll want to
install this fix.  Otherwise users who forget to log out get billed
for all of the time that the system is down.  I found this bug in
our 4.1bsd system, but I strongly suspect that it is fairly widely
spread.

				Bob Van Valzah
				(...!decvax!ittvax!tpdcvax!bobvan)



More information about the Net.bugs mailing list