[comp.sources.bugs] "fast find" fails to find the last file

pokey@well.UUCP (Jef Poskanzer) (04/26/89)

Description:

Fast find exits its loop a bit too early -- it doesn't check whether
the last line it reads from find.codes matches the pattern.

Repeat-By:

Find out what the last line in your find.codes is.  On my system it
is currently "/vmunix".  Try a fast find on it, e.g. "find /vmunix".

Fix:

*** find.c.old	Sat Apr 22 18:38:06 1989
--- find.c	Sat Apr 22 18:39:06 1989
***************
*** 1209,1216 ****
  		globflag = NO;
  	patend = patprep ( pathpart );
  
! 	c = getc ( fp );
! 	for ( ; ; ) {
  
  		count += ( (c == ESCCODE) ? getw ( fp ) : c ) - OFFSET;
  
--- 1209,1215 ----
  		globflag = NO;
  	patend = patprep ( pathpart );
  
! 	for ( c = getc ( fp ); c != EOF; ) {
  
  		count += ( (c == ESCCODE) ? getw ( fp ) : c ) - OFFSET;
  
***************
*** 1219,1226 ****
  				*p++ = c;
  			else		/* bigrams are parity-marked */
  				*p++ = bigram1[c & 0177],  *p++ = bigram2[c & 0177];
- 		if ( c == EOF )
- 			break;
  		*p-- = NULL;
  		cutoff = ( found ? path : path + count);
  
--- 1218,1223 ----