[comp.bugs.2bsd] rwhod files have wrong mode

sms@wlv.imsd.contel.com (Steven M. Schultz) (07/21/89)

	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);
  	}
  }