Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site ccivax.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!rochester!ritcv!ccivax!crp From: crp@ccivax.UUCP (Chuck Privitera) Newsgroups: net.bugs.4bsd Subject: Bug in rwhod Message-ID: <201@ccivax.UUCP> Date: Fri, 7-Sep-84 11:27:04 EDT Article-I.D.: ccivax.201 Posted: Fri Sep 7 11:27:04 1984 Date-Received: Sun, 16-Sep-84 08:17:29 EDT Distribution: net Organization: CCI Telephony Systems Group, Rochester NY Lines: 41 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