[net.news.b] Another bug fix for cancel_command

dmmartindale@watcgl.UUCP (Dave Martindale) (09/25/83)

There are several problems with the routine cancel_command()
which is a part of readr.c in 2.10.1.  As distributed, it loses
one file descriptor every time you cancel the current article.
Also, every time you cancel any article, the current article
become inaccessible, even if the article you are cancelling is
the previous one.  If you try to do a '+' at that point, you get
a bus error.  Several weeks ago, I published a suggested fix
for the lost-file-descriptor problem; you should ignore that since
the change I am about to describe fixes both problems.

The fix is simply to move the three lines at the bottom of the
routine into the "if" preceding them, and delete the redundant
"fp = NULL".  The original code looks like:


		obit = -1;
		fp = NULL;
		if (!cflag)
			putc('\n', ofp);
	}
	if (fp != NULL)
		fclose(fp);
	fp = NULL;

and the new code should look like:

		obit = -1;
		if (!cflag)
			putc('\n', ofp);
		if (fp != NULL)
			fclose(fp);
		fp = NULL;
	}