Runaway Sendmails

Chris Torek chris at umcp-cs.UUCP
Sun Apr 13 02:42:08 AEST 1986


In article <56 at uscvax.UUCP> pv at usc-cse.UUCP (Peter Vanderbilt) writes:
>Several times in the last few weeks, we have had sendmails that create
>infinite df* files (in /usr/spool/mqueue) -- the last line is repeated until
>space runs out on /usr.

I had to fix this once or twice.  There are, as I recall, two loops
in sendmail of the form

	while (!feof(infile)) {
		...
		(void) fgets(buf, sizeof (buf), infile);
		if (ferror(infile))
			[do something about error];
		[append line to data file];
		...
	}

The author obviously expected ferror(infile) to imply feof(infile);
but it does not.  A quick fix is to change the conditions on the
loops to

	while (!feof(infile) && !ferror(infile))

(the loops are in fact `for's, if I recall correctly, so take care
with your search strings; but this is not otherwise important).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu



More information about the Comp.unix.wizards mailing list