grap bug (DWB 2.0) + FIX
Richard Stevens
stevens at hsi.UUCP
Wed Oct 26 21:36:43 AEST 1988
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);
> }
More information about the Comp.bugs.sys5
mailing list