Bug in find

Sid Stuart sid at linus.UUCP
Sun Feb 17 09:52:10 AEST 1985


Date: Feb 16 1985
From: Sid Stuart at linus!sid
Subject: Fix for find dumping core.
Index: find.c 4.2
Description:
	Find dumped core on me. The problem occurs when
	the code uses a table of pointers to functions. Most of
	the functions want a pointer to a structure passed to them
	as a parameter. Three of them don't, print, cpio, and newer.
	When the pointer to one of these is used, the pointer to the
	structure is passed, but they are not set up to handle it. The
	fix is pretty obvious, have them accept the pointer, even though
	they don't use it.

Repeat by:	Well, it dumped core on me when I said,

		find / -user news -print | more

		but I think the malfunction could be random.

Fix:	This is from a "diff find.old find.fixed" 

287c301,308
< print()
---
> print(trash)	/* The trash variable is not used. It is needed because
> 		   the function is called by pointer from a table.
> 		   When functions are called from the table, they
> 		   passed a pointer to an anode structure. 
> 		   If print does not accept this argument, find will sometimes
> 		   dump core.
> 		 */
> register struct anode *trash;
371c401,402
< cpio()
---
> cpio(trash)	/* The trash variable is not used. See definition of print. */
> register struct anode *trash;
428c459,460
< newer()
---
> newer(trash) /* The trash variable is not used. See definition of print. */
> register struct anode *trash;



/* End of bug report */



More information about the Comp.bugs.4bsd.ucb-fixes mailing list