🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: net.sources.bugs
1 messages
1 total messages Started by wpl Tue, 24 Mar 1987 01:01
Bug fix for vn
#982
Author: wpl
Date: Tue, 24 Mar 1987 01:01
47 lines
2048 bytes
I had a problem with vn.  Once in a while, vn would crash with a floating
point exception (divide by zero).  I tracked to bug to the following lines
of code in reader.c.

	/* for conditional is abnormal - expected exit is break */
	for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count)
	{

		/* reset position and bail out at first non-header line */
		if (index(buf,':') == NULL)
		{
			pos = ftell(Fpread);
			pos -= strlen(buf);
			fseek (Fpread,pos,0);
			break;
		}


Vn had thought the header ended when there was a line with no ':'. This is
a false assumption (I think), a header ends when there is a line that doesn't
begin with ' ' or '\t' and has no embedded ':'.
Below is the fix to the above code.


	/* for conditional is abnormal - expected exit is break */
	for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count)
	{

		/* reset position and bail out at first non-header line */
		if (index(buf,':') == NULL)
		{
                        if ((buf[0] != '\t') && (buf[0] != ' ')) {
				pos = ftell(Fpread);
				pos -= strlen(buf);
				fseek (Fpread,pos,0);
				break;
                        }
		}


Bill Loftus
-- 
William P Loftus			UUCP:   wpl@burdvax, sword@excalibur
Unisys/Paoli Research Center		ARPA: 	wpl@burdvax.prc.unisys.com
PO Box 517				BITNET: SWORD@VUVAXCOM
Paoli, PA 19301                         215-648-7222 (work) 215-649-0633 (home)
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