[net.sources.games] Hack.1.0.2 bug fix.

kopper@psuvax1.UUCP (04/20/85)

Hi!

There is a bug in the '/' command. Try executing it about 16+ times
on some valid item. Hack should at that point run out of file descriptors.
The fix is to add a fclose(fp) in hack.pager.c (enclosed is a context diff).
Time to get back to work.

Happy hacking!!!!!! (sure hope this fix works everywhere... it works here!)

David Kopper, Pennsylvania State University

Uucp:	{akgua, allegra, cornell, purdue, ihnp4, burdvax}!psuvax1!kopper
Apra:   kopper%PSUVAX1.BITNET@Berkeley (I think, but I'm not sure)
Bitnet:	kopper@psuvax1.BITNET
	kopper@psuvaxg.BITNET
CSnet:	kopper@penn-state
MaBell:	(814) 234-4519
USmail:	670 East Prospect Ave., Apt. E
	University Park, PA 16801


*** old.hack.pager.c	Fri Apr 19 10:34:09 1985
--- hack.pager.c	Fri Apr 19 21:01:53 1985
***************
*** 44,49
  				if(readchar() == 'y')
  					page_more(fp,1); /* does fclose() */
  			}
  			return(0);
  		    }
  		pline("I've never heard of such things.");

--- 44,50 -----
  				if(readchar() == 'y')
  					page_more(fp,1); /* does fclose() */
  			}
+ 			(void) fclose(fp); /* fixed... kdx */
  			return(0);
  		    }
  		pline("I've never heard of such things.");
-- 

David Kopper, Pennsylvania State University

Uucp:	{akgua, allegra, cornell, pitt, purdue, ihnp4, burdvax}!psuvax1!kopper
Apra:   kopper%PSUVAX1.BITNET@Berkeley (I think)
Bitnet:	kopper@psuvax1.BITNET
	kdx@psuvm
CSnet:	kopper@psuvax1.CSNET
	kopper@penn-state
MaBell:	(814) 234-4519
USmail:	670 East Prospect Ave., Apt. E
	University Park, PA 16801

aeb@mcvax.UUCP (Andries Brouwer) (04/25/85)

In article <1637@psuvax1.UUCP> kopper@psuvax1.UUCP writes:
>
>There is a bug in the '/' command. Try executing it about 16+ times
>on some valid item. Hack should at that point run out of file descriptors.
>The fix is to add a fclose(fp) in hack.pager.c (enclosed is a context diff).
>
>*** old.hack.pager.c	Fri Apr 19 10:34:09 1985
>--- hack.pager.c	Fri Apr 19 21:01:53 1985
>***************
>*** 44,49
>  				if(readchar() == 'y')
>  					page_more(fp,1); /* does fclose() */
>  			}
>  			return(0);
>  		    }
>  		pline("I've never heard of such things.");
>
>--- 44,50 -----
>  				if(readchar() == 'y')
>  					page_more(fp,1); /* does fclose() */
>  			}
>+ 			(void) fclose(fp); /* fixed... kdx */
>  			return(0);
>  		    }
>  		pline("I've never heard of such things.");

This fix is more important than you might think - if you run out of
file descriptors and seven hours later finish the game with the score
of the century you'll get the reply "Cannot open record file".
So, this fix should really be installed.