[net.news.b] Bug with pathinit and notify file in 2.10.3 beta.

tim@teldata.UUCP (12/18/85)

Description:
        When pathinit reads  the "notify"  file the newline  at the  end
        never gets stripped off.  This  causes a problem when running  a
        checkgroups message.  The newline causes the checkgroup  command
        to never receive the newsgroup list from standard in.

							Newline here |
								     V
	Dec 18 10:48	local	system(/usr/lib/news/checkgroups news
	 < /teldata/news/.in027858) status 0

	This problem could be in other versions of 2.10.3.

	(News version: B 2.10.3 4.3bsd-beta 6/6/85)

Repeat-by:
        Make sure NOTIFY is defined then create a "notify" file (if  one
        doesn't exist) and  run any  of the checkgroup  reports sent  by
        Gene Spafford  in  net.news.group.   You  should get  a  message
        saying all groups are invalid and  an entry in the logfile  like
        the one above.

Fix-by:
	The following context diff shows the fix.

*** pathinit.c	Wed Dec 18 11:15:14 1985
--- pathinit.c.new	Wed Dec 18 11:22:22 1985
***************
*** 86,91
  {
  #if defined(INEW) && defined(NOTIFY)
  	FILE	*nfd;		/* notify file descriptor		*/
  #endif /* INEW && NOTIFY */
  #ifndef ROOTID
  	struct passwd	*pw;	/* struct for pw lookup			*/

--- 86,92 -----
  {
  #if defined(INEW) && defined(NOTIFY)
  	FILE	*nfd;		/* notify file descriptor		*/
+ 	char	*p;
  #endif /* INEW && NOTIFY */
  #ifndef ROOTID
  	struct passwd	*pw;	/* struct for pw lookup			*/
***************
*** 170,175
  	if (nfd != NULL) {
  		bfr[0] = '\0';
  		(void) fgets(bfr, BUFLEN, nfd);
  		TELLME = AllocCpy(bfr);
  		(void) fclose(nfd);
  	} else

--- 171,178 -----
  	if (nfd != NULL) {
  		bfr[0] = '\0';
  		(void) fgets(bfr, BUFLEN, nfd);
+ 		if ((p = rindex(bfr,'\n')) != 0)  /* Strip off any newline */
+ 			*p = '\0';
  		TELLME = AllocCpy(bfr);
  		(void) fclose(nfd);
  	} else
-- 
-----
                                        Tim Rosmus
...uw-beaver_____!tikal!tim             Teltone Corporation
.......fluke___/                        120th Ave. N.E.
...microsoft__/                         Kirkland, WA  98033
                                        (206) 827-9626