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;
|