[net.bugs.v7] awful botches in uucico/anlwrk.c

henry (06/04/82)

Some of the code in the anlwrk routines in uucico looks like it was
written by Neanderthals, or else patched and re-patched by someone
who didn't understand it.

When asked to get a file of work, the routines first check a list of
pending work;  if the list is empty, they refill it by scanning the
directory.  This is fine.  BUT:

1. The in-core list is only 10 items long.
2. The directory-scan loop scans the ENTIRE directory even if the
	list was filled up by the first 10 files.
3. The loop allocates space for the filename, and copies it into said
	space, BEFORE it knows whether there is an empty slot in the
	list for that filename.  If the list is full, that space is
	NEVER FREED!

The combination of these results in EXTREMELY slow operation of uucico
if the directory is big.  In fact, the other end can time out while
uucico is rescanning the directory!  This can make it very hard to
clean out the pileup when one of your neighbors has been down for a
while.

The fixes are quite straightforward.  In anlwrk.c, change the value
of LLEN from 10 to (say) 50.  In anlwrk.c/gtwrk(), change the loop
condition to add "&& (last - first) < llen".  You can take out the
similar check in the if towards the end of the loop, it being now
redundant.