Another news 2.10.1 bug

ado at elsie.UUCP ado at elsie.UUCP
Fri Feb 3 09:16:01 AEST 1984


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



More information about the Net.bugs mailing list