[gnu.utils.bug] diff-1.4 bug.

roger@UUNET.UU.NET (Roger Florkowski) (01/20/89)

In diff-1.4, there is a bug when you:

diff filename dirname

where filename is contained in the directory dirname.  The bug
is that compare_files frees the dirname even though it came
from argv[].  This patch checks if should free it first.

*** diff.c~	Fri Oct  7 03:18:42 1988
--- diff.c	Fri Jan 20 02:56:43 1989
***************
*** 476,482 ****
  	}
        else
  	{
! 	  free (inf[dir_arg].name);
  	  inf[dir_arg].name = filename;
  	  if (fstat (inf[dir_arg].desc, &inf[dir_arg].stat) < 0)
  	    pfatal_with_name (inf[dir_arg].name);
--- 476,483 ----
  	}
        else
  	{
! 	  if ( 0 != (dir_arg ? dir1 : dir0))
! 	    free (inf[dir_arg].name);
  	  inf[dir_arg].name = filename;
  	  if (fstat (inf[dir_arg].desc, &inf[dir_arg].stat) < 0)
  	    pfatal_with_name (inf[dir_arg].name);
--
Roger Florkowski				uunet!uvm-gen!banzai!roger
The People's Computer Company			`Revolutionary Programming'