Path: utzoo!attcan!uunet!husc6!bloom-beacon!think!ames!necntc!ima!haddock!craigk From: craigk@haddock.ISC.COM (Craig Kolb) Newsgroups: comp.sources.bugs Subject: news 2.11 ihave/sendme bug Summary: behavior of BSD/USG fopen(file, "a") differ Message-ID: <5434@haddock.ISC.COM> Date: 25 Jul 88 16:02:16 GMT Reply-To: craigk@haddock.isc.com (Craig Kolb) Organization: Interactive Systems, Boston Lines: 33 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@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) {