Xref: utzoo comp.bugs.sys5:643 comp.text:2676 Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!hsi!stevens From: stevens@hsi.UUCP (Richard Stevens) Newsgroups: comp.bugs.sys5,comp.text Subject: grap bug (DWB 2.0) + FIX Message-ID: <193@hsi86.hsi.UUCP> Date: 26 Oct 88 11:36:43 GMT Article-I.D.: hsi86.193 Organization: Health Systems Intl., New Haven, CT Lines: 32 Index: grap.d/print.c - Documenter's Workbench, 2.0 Description: Grap isn't closing all its files. Specifically, for every "copy thru" that it encounters, it opens its temporary file twice, but only closes it once. Repeat-By: Create a file with a lot of "copy thru". On 4.3 BSD (which allows 64 open files per process) grap died on about the 60'th copy thru file. Fix: The function reset() is being called twice, causing the tempfile to be opened twice. The following patch corrects the problem. RCS file: RCS/print.c,v retrieving revision 1.1 retrieving revision 1.2 diff -r1.1 -r1.2 209,211c209,215 < if (tfd != stdout && (tfd = fopen(tempfile, "w")) == NULL) { < fprintf(stderr, "grap: can't open %s\n", tempfile); < exit(1); --- > if (tfd != stdout) { > if (tfd != NULL) > fclose(tfd); > if ((tfd = fopen(tempfile, "w")) == NULL) { > fprintf(stderr, "grap: can't open %s\n", tempfile); > exit(1); > }