[comp.bugs.4bsd] fixes to nntpxmit

matt@oddjob.UChicago.EDU (Ka Kahula) (03/06/87)

We were starting nntpxit sessions so often that sometimes one
would begin while another one was still in progress.  Also
there is extra junk after the Message-ID in many (but not all)
articles from UMass.  The following changes to the version of
nntpxmit that is on the 4.3 tape fix these problems.

RCS file: RCS/nntpxmit.c,v
retrieving revision 1.1
diff -c -r1.1 nntpxmit.c
*** /tmp/,RCSt1015808	Fri Mar  6 12:00:52 1987
--- nntpxmit.c	Fri Mar  6 11:05:39 1987
***************
*** 136,141 ****
--- 136,153 ----
  		return(FALSE);
  	}
  
+ #ifdef LOCK_EX
+ 	/*
+ 	** interlock with other copies of this process
+ 	*/
+ 	if (flock(fileno(filefile), LOCK_EX|LOCK_NB) != 0) {
+ 		dprintf(stderr, "%s: flock %s: %s\n", pname, file, errmsg(errno));
+ 		syslog(LOG_INFO, "%s: flock failed: %m\n", host);
+ 		fclose(filefile);
+ 		return(FALSE);
+ 	}
+ #endif
+ 
  	if (hello(host) == FAIL) {
  		fclose(filefile);
  		return(FALSE);
***************
*** 193,198 ****
--- 205,211 ----
  {
  	struct hbuf	header;
  	char	scr[LBUFLEN];
+ 	char	*cp;
  
  	bzero(&header, sizeof(header));
  	if (rfc822read(&header, fp, scr)) {
***************
*** 208,213 ****
--- 221,229 ----
  			fprintf(stderr, "%s: article w/o message-id!\n", pname);
  			return(ERR_GOTIT);
  		}
+ 		/* Nuke the pinheaders from UMass ! */
+ 		if ((cp = index(header.ident, '>')) && *++cp)
+ 			*cp = '\0';
  		sprintf(buf, "IHAVE %s", header.ident);
  		if (Do_Stats) Stats.offered++;
  
________________________________________________________
Matt	     University		matt@oddjob.uchicago.edu
Crawford     of Chicago     {astrovax,ihnp4}!oddjob!matt