Patch patch...

ekrell at ucla-cs.UUCP ekrell at ucla-cs.UUCP
Mon Nov 26 11:49:42 AEST 1984


In article <320 at rna.UUCP> dan at rna.UUCP (Dan Ts'o) writes:
>
>	Alas things are still not well with patch - I occassionally get
>core dumps in malloc(), via savestr(), but I haven't had a chance to
>track that one down yet.

  Here's the fix for that problem (The last pointer of i_ptr was pointing
to garbage):

*** patch.c	Sun Nov 25 17:41:58 1984
--- patch.c.new	Sun Nov 25 22:53:08 1984
***************
*** 750,756
  
      iline = 1;
      i_ptr[iline] = i_womp;
!     for (s=i_womp; *s; s++) {
  	if (*s == '\n')
  	    i_ptr[++iline] = s+1;	/* these are NOT null terminated */
      }

--- 750,756 -----
  
      iline = 1;
      i_ptr[iline] = i_womp;
!     for (s=i_womp; *(s+1); s++) {
  	if (*s == '\n')
  	    i_ptr[++iline] = s+1;	/* these are NOT null terminated */
      }
***************
*** 754,760
  	if (*s == '\n')
  	    i_ptr[++iline] = s+1;	/* these are NOT null terminated */
      }
!     input_lines = iline - 1;
  
      /* now check for revision, if any */
  

--- 754,760 -----
  	if (*s == '\n')
  	    i_ptr[++iline] = s+1;	/* these are NOT null terminated */
      }
!     input_lines = iline;
  
      /* now check for revision, if any */
  
-- 
    Eduardo Krell               UCLA Computer Science Department
    ekrell at ucla-locus.arpa      ..!{sdcrdcf,ihnp4,trwspp,ucbvax}!ucla-cs!ekrell



More information about the Comp.sources.bugs mailing list