Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site elsie.UUCP
Path: utzoo!watmath!clyde!floyd!harpo!seismo!rlgvax!cvl!elsie!ado
From: ado@elsie.UUCP
Newsgroups: net.bugs
Subject: Re: Another news 2.10.1 bug
Message-ID: <801@elsie.UUCP>
Date: Thu, 2-Feb-84 18:16:01 EST
Article-I.D.: elsie.801
Posted: Thu Feb  2 18:16:01 1984
Date-Received: Wed, 8-Feb-84 03:15:50 EST
References: <5644@mcvax.UUCP>
Organization: NIH-LCM, Bethesda, MD
Lines: 21

A recent posting read:
	There's another "forget-to-close" bug in ifuncs.c: At the start of
	broadcast() there is an `xfopen("ARTICLE", "r")' almost immediately
	followed by a fclose(fp).  Within the next while loop transmit() is
	called with as one of its arguments (again) `xfopen("ARTICLE", "r"))'.
	Now transmit() can return in several ways without closing the file,
	which leaves you with too many open file descriptors when broadcasting
	too many systems.  To fix it:
	- move the fclose(fp) to after the while loop;
	- replace the transmit() call by:
		fseek(fp, 0L, 0);
		transmit(&srec, fp, 1);
	- remove the fclose(ifp) from transmit().
Note, however, that there are calls to "transmit" in places other than
"broadcast", and the calls in these other places depend on "transmit" to
close the file.  So, perhaps the "make it work as designed" fix is to:
	- ensure that transmit always calls fclose on ifp (if ifp is other
	  than NULL) before returning.
-- 
UUCP:	decvax!harpo!seismo!rlgvax!cvl!elsie!ado
DDD:	(301) 496-5688