bug in "x" netnews gateway program

Ralph Chapman (starnet!apple!starlight.chi.il.us!ralph)
Tue, 8 Feb 1994 23:51:52 -0600 (CST)

I've just recently installed the dist1293 package on my Linux system, and I
love it! I did discover a bug, however, that causes "file table overflow"
when running the "x" program without the "-s" option.

The bug is an extra call to fopen in stock.c -- Every time it writes stock
data to an individual stock/symbol file, it opens the file twice, dropping
the FILE struct pointer for the first open. The program runs continuously,
so the files stay open, and are re-opened whenever updated stock data is
written. Eventually those "opens" fill up the system's file table (a fixed-
size structure that keeps track of I/O to/from files that are currently in
use). That condition is not fatal, so the system, and the "x" program, keep
running, but no more files can be opened, which prevents any more programs
from being run.

Here's a patch to fix it:

----- cut here ----- 8< ----- cut here ----- 8< ----- cut here ----- 8< -----
*** stock.c~ Thu Dec 23 10:17:57 1993
--- stock.c Tue Feb 8 21:56:34 1994
***************
*** 331,337 ****
}
return;
}
- fp = fopen(line, "a");
if ((fp = fopen(line, "a")) == NULL)
fprintf(stderr,"OPEN STOCK %s FAILED %s\n",line,
sys_errlist[errno]);
--- 331,336 ----
----- cut here ----- 8< ----- cut here ----- 8< ----- cut here ----- 8< -----

Apart from this minor annoyance, I am sincerely grateful to all of the folks
who had a hand in developing this marvelous facility.

-------------------------------------------------------------------------------
Ralph Chapman home: ralph@starlight.chi.il.us
office: ralph.chapman@att.com