stu@jpusa1.UUCP (Stu Heiss) (06/03/86)
Problem: inews not updating dbm files correctly. newskit version: /* @(#)defs.dist 2.47 6/6/85 */ #define NEWS_VERSION "B 2.10.3 4.3bsd-beta 6/6/85" ifuncs.c version: static char *SccsId = "@@(#)ifuncs.c 2.47 6/6/85"; I tracked my inews/dbm promblem down to the savehist() function in ifuncs.c. The problem is that the open-for-append of the history file doesn't set the file ptr offset to eof before the ftell(), at least with Unisoft sys5 release 1. Ftell() retruns 0 untill the write; by then it's too late and the offset being stored in the dbm file is bogus. The fix is to do an fseek to eof before the ftell. Diff follows below: NOTE TO 2.10.3 SYSTEMS: rick@seismo sent me a note describing a fix to rn for 2.10.3's leaving out the Posting-Version and Relay-Version lines. I hadn't seen it and my beta version still leaves those lines in so it had nothing to do with my current problem but will cause problems as we go to the new 2.10.3 behavior. Perhaps the patch should be reposted. *** ifuncs.c.bad --- ifuncs.c Sat May 31 15:45:22 1986 *************** *** 515,520 register char *p; hfp = xfopen(ARTFILE, "a"); fpos = ftell(hfp); fprintf(hfp, "%s\n", hline); (void) fclose(hfp); --- 515,521 ----- register char *p; hfp = xfopen(ARTFILE, "a"); + (void) fseek(hfp, 0L, 2); fpos = ftell(hfp); fprintf(hfp, "%s\n", hline); (void) fclose(hfp); -- Stu Heiss {ihnp4!jpusa1!stu}