Diff Bug

utzoo!decvax!ucbvax!romine at SRC-Unix utzoo!decvax!ucbvax!romine at SRC-Unix
Fri Nov 6 06:00:20 AEST 1981


From: Raleigh F. Romine <romine at SRC-Unix>
There appear to be two bugs in the 2.8BSD diff source.
In diffdir.c a cast to unsigned is needed in a malloc call and
in diffreg.c a fprintf call needs a stream argument.  
A diff listing follows:

*** diffdir.c	Fri Nov  6 08:13:39 1981
--- diffdir.c_	Fri Nov  6 08:04:26 1981
***************
*** 185,191
  		done();
  	}
  	fstat(0, &stb);
! 	dp = (struct direct *)malloc((unsigned)stb.st_size + sizeof (struct direct));
  	if (dp == 0) {
  		fprintf(stderr, "diff: ran out of memory\n");
  		done();

--- 185,191 -----
  		done();
  	}
  	fstat(0, &stb);
! 	dp = (struct direct *)malloc(stb.st_size + sizeof (struct direct));
  	if (dp == 0) {
  		fprintf(stderr, "diff: ran out of memory\n");
  		done();
*** diffreg.c	Fri Nov  6 08:15:34 1981
--- diffreg.c_	Fri Nov  6 08:14:51 1981
***************
*** 167,173
  	tempfile = mktemp("/tmp/dXXXXX");
  	f = creat(tempfile,0600);
  	if (f < 0) {
! 		fprintf(stderr,"diff: ");
  		perror(tempfile);
  		done();
  	}

--- 167,173 -----
  	tempfile = mktemp("/tmp/dXXXXX");
  	f = creat(tempfile,0600);
  	if (f < 0) {
! 		fprintf("diff: ");
  		perror(tempfile);
  		done();
  	}


Raleigh



More information about the Comp.bugs.2bsd mailing list