Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0107/1

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Correct stat size.
 [rsc] --rw-rw-r-- M 73506 glenda sys 1723 Jan  7 11:37 sys/src/ape/lib/ap/plan9/dirstat.c
	/n/sourcesdump/2006/0107/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:18,28 - 
	/n/sourcesdump/2006/0108/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:18,28
	  
	  	nd = DIRSIZE;
	  	for(i=0; i<2; i++){	/* should work by the second try */
	- 		d = malloc(sizeof(Dir) + nd);
	+ 		d = malloc(sizeof(Dir) + BIT16SZ +nd);
	  		if(d == nil)
	  			return nil;
	  		buf = (uchar*)&d[1];
	- 		n = _STAT(name, buf, nd);
	+ 		n = _STAT(name, buf, BIT16SZ+nd);
	  		if(n < BIT16SZ){
	  			free(d);
	  			return nil;
	/n/sourcesdump/2006/0107/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:32,38 - 
	/n/sourcesdump/2006/0108/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:32,38
	  			_convM2D(buf, n, d, (char*)&d[1]);
	  			return d;
	  		}
	- 		/* else sizeof(Dir)+nd is plenty */
	+ 		/* else sizeof(Dir)+BIT16SZ+nd is plenty */
	  		free(d);
	  	}
	  	return nil;


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.