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

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.