[comp.sources.bugs] MUSH bug fix

kai@uicsrd.UUCP (09/30/87)

On my BSD system (Sequent DYNIX V2.1), MUSH displayed error messages ("fseek
in ...") while displaying the mail message headers, even though there was no
actual error.

The fix is simple.  In the file hdrs.c, change line 21 to check explicitly
for -1 instead of non-zero values.  It seems that fseek somtimes returns
positive values.  Here is a diff.

21c21
<     if (fseek(tmpf, msg[n].m_offset, L_SET) != 0) {
---
>     if (fseek(tmpf, msg[n].m_offset, L_SET) == -1) {

Patrick Wolfe
Internet:  pwolfe@kai.com
UUCP:      ...!{uunet,ihnp4}!uiucuxc!kailand!pwolfe

The opinions expressed here are my own, NOT my employers.

phb@dmnhack.UUCP (10/13/87)

I got a core dump from an infinite recursion in the function "Addstr".
A quick scan of it indicates that this might be the problem:

line 151 of rite.c:
	if (newline == '\n' && !*++s)

Should probably be:
	++s;
	if (newline == '\n' && !*s)

hildreth@cg-atla.UUCP (Lon Hildreth X7065) (10/20/87)

In article <131@dmnhack.UUCP> phb@dmnhack.UUCP writes:
>I got a core dump from an infinite recursion in the function "Addstr".
>A quick scan of it indicates that this might be the problem:
>
>line 151 of rite.c:
>	if (newline == '\n' && !*++s)
>
>Should probably be:
>	++s;
>	if (newline == '\n' && !*s)

No.  Don't be too anxious with this -- clearly, the intent is to not
increment 's' UNLESS 'newline == '\n'.  The real fix is in copy_msg()
where it checks the msg_rect.r_width/r_height to see if they are big
enough to handle *any* text.  Add the code in msgs.c:

	if (msg_rect.r_width < 2 * l_width(curfont) ||
	    msg_rect.r_height < 2 * l_height(curfont))
		return;

at the same place where msg_rect size is already being tested.  Sorry,
I can't supply diffs.
-- 
Lon Hildreth		...!{decvax,ima,ism780c,ulowell}!cg-atla!hildreth
Compugraphic Corp	"You can't beat fun at the old ball park."
Wilmington, MA					- Harry Caray