news 2.11 ihave/sendme bug

Craig Kolb craigk at haddock.ISC.COM
Tue Jul 26 02:02:16 AEST 1988


There is a bug in the c_ihave() routine of 2.11 rnews which keeps
sendme messages from being generated in response to ihave messages on
USG systems.

The problem lies in the fact that USG systems to not seek to EOF after
fopening a file for appending until a write() is performed.  Thus, the
first call to ftell() in c_ihave() returns 0 rather than the size of
the temporary file, the code inside the while loop is never executed,
and no articles are requested.

A simple call to fseek() solves the problem.  A context diff follows.

Craig Kolb
craigk at haddock.isc.com

*** /usr/src/local/news/src/control.c	Fri Dec  4 15:17:38 1987
--- control.c	Mon Jul 25 11:18:28 1988
***************
*** 187,192 ****
--- 187,199 ----
  		char		myid[256];
  
  		outfp = xfopen(INFILE, "a");
+ #ifdef USG
+ 		/*
+ 		 * When fopening to append, USG systems don't
+ 		 * seek to EOF until write() is called.
+ 		 */
+ 		fseek(outfp, 0L, 2);
+ #endif
  		outpos = ftell(outfp);
  		inpos = ftell(infp);
  		while (ftell(infp) < outpos) {



More information about the Comp.sources.bugs mailing list