freebsd-ports/textproc/heirloom-doctools/files/patch-refer_refer7.c
Hiroki Sato a325abe66b - Fix bugs which could cause SIGSEGV.
- Fix an odd error message "sort: file not found".
  It was not harmful but confusing.
- Increase the maximum number of vertexes in a spline curve.
  100 vertexes were too small in modern environments.
- Use _PATH_* wherever possible.
2017-03-30 23:54:24 +00:00

29 lines
554 B
C

--- refer/refer7.c.orig 2016-03-09 21:27:38 UTC
+++ refer/refer7.c
@@ -56,16 +56,21 @@ dumpold(void)
if (!endpush)
return;
- fclose(fo);
- fo = NULL;
+ if (fo != NULL) {
+ fclose(fo);
+ fo = NULL;
+ }
+ fi = fopen(tfile, "r");
+ if (fi == NULL)
+ return;
if (sort) {
char comm[100];
+
+ fclose(fi);
snprintf(comm, sizeof(comm), "sort -f %s -o %s", tfile, tfile);
system(comm);
+ fi = fopen(tfile, "r");
}
- fi = fopen(tfile, "r");
- if (fi == NULL)
- return;
flout();
fprintf(ftemp, ".]<\n");
while ((c = getc(fi)) > 0) {