Bug in rwhod
Chuck Privitera
crp at ccivax.UUCP
Sat Sep 8 01:27:04 AEST 1984
Index: /usr/src/etc/rwhod/rwhod.c 4.2BSD
Description:
There is a minor nit in rwhod as distributed with 4.2 .
In the routine onalrm(), they stat /etc/utmp to try to avoid
re-reading it if it hasn't changed since the last time they
read it. The only problem is that they never save the last-read
time, so rwhod re-reads utmp every minute. The one line fix
is given below in a context diff.
Repeat-by:
Just read the code.
Fix:
rcsdiff -c -r1.1 rwhod.c
RCS file: RCS/rwhod.c,v
retrieving revision 1.1
diff -c -r1.1 rwhod.c
*** /tmp/,RCSt1002139 Fri Sep 7 10:29:39 1984
--- rwhod.c Fri Sep 7 10:27:41 1984
***************
*** 235,240
alarmcount++;
(void) fstat(utmpf, &stb);
if (stb.st_mtime != utmptime) {
(void) lseek(utmpf, (long)0, L_SET);
cc = read(utmpf, (char *)utmp, sizeof (utmp));
if (cc < 0) {
--- 235,241 -----
alarmcount++;
(void) fstat(utmpf, &stb);
if (stb.st_mtime != utmptime) {
+ utmptime = stb.st_mtime;
(void) lseek(utmpf, (long)0, L_SET);
cc = read(utmpf, (char *)utmp, sizeof (utmp));
if (cc < 0) {
--
Chuck Privitera, Computer Consoles Inc.
{allegra,seismo}!rochester!ritcv!ccivax!crp
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list