Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!apple!voder!wlbr!wlv.imsd.contel.com!sms From: sms@wlv.imsd.contel.com (Steven M. Schultz) Newsgroups: comp.bugs.2bsd Subject: rwhod files have wrong mode Keywords: rwhod Message-ID: <33665@wlbr.IMSD.CONTEL.COM> Date: 20 Jul 89 21:45:06 GMT Sender: news@wlbr.IMSD.CONTEL.COM Reply-To: sms@wlv.imsd.contel.com (Steven M. Schultz) Organization: Contel Federal Systems Lines: 24 This isn't really a "bug", but a fix for an annoyance. 'rwhod' uses the system default for its umask() and can end up creating files which only the superuser can read. the choice was to either make 'ruptime' setuid or reserved to superusers only, or to have 'rwhod' change the mode to something reasonable. The fix below or's in 0444 to the mode - forcing the files to be readable by everyone. *** rwhod.c.old Wed Jul 12 23:47:51 1989 --- rwhod.c Thu Jul 20 13:48:33 1989 *************** *** 223,228 **** --- 223,231 ---- (void) write(whod, (char *)&wd, cc); if (fstat(whod, &st) < 0 || st.st_size > cc) ftruncate(whod, (long)cc); + #define ALLREAD (S_IREAD | (S_IREAD >> 3) | (S_IREAD >>6)) + if ((st.st_mode & ALLREAD) != ALLREAD) + fchmod(whod, st.st_mode | ALLREAD); (void) close(whod); } }