🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Piet Beertema Fri, 13 Jan 1984 17:04
Another news 2.10.1 bug
#167
Author: Piet Beertema
Date: Fri, 13 Jan 1984 17:04
19 lines
1202 bytes
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().
-- 
	Piet Beertema
	CWI (Center for Math. & Comp. Science), Amsterdam
	...{decvax,philabs}!mcvax!piet
Re: Another news 2.10.1 bug
#179
Author: ado
Date: Thu, 02 Feb 1984 23:16
21 lines
1563 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads