9boot: fix isowalk() for directories spanning multiple sectors
directory entries cannot span sector boundaries, meaning that the end of a sector would be zero padded until the next sector. we have to skip over these zero paddings to fully read the directory.
This commit is contained in:
parent
e279699344
commit
546f8cfeca
2 changed files with 16 additions and 8 deletions
|
@ -129,15 +129,19 @@ Foundpvd:
|
|||
return 0;
|
||||
|
||||
for(;;){
|
||||
if(readn(ex, &d, Dirsz) != Dirsz)
|
||||
if(read(ex, &d.dirlen, 1) != 1)
|
||||
break;
|
||||
if(d.dirlen == 0)
|
||||
continue; /* zero padding to next sector */
|
||||
if(read(ex, &d.dirlen + 1, Dirsz-1) != Dirsz-1)
|
||||
break;
|
||||
if(readn(ex, name, d.namelen) != d.namelen)
|
||||
if(read(ex, name, d.namelen) != d.namelen)
|
||||
break;
|
||||
i = d.dirlen - (Dirsz + d.namelen);
|
||||
while(i-- > 0)
|
||||
read(ex, &c, 1);
|
||||
while(i-- > 0){
|
||||
if(read(ex, &c, 1) != 1)
|
||||
break;
|
||||
}
|
||||
for(i=0; i<d.namelen; i++){
|
||||
c = name[i];
|
||||
if(c >= 'A' && c <= 'Z'){
|
||||
|
|
|
@ -111,15 +111,19 @@ isowalk(Extend *ex, int drive, char *path)
|
|||
ex->len = *((ulong*)(ex->buf + 156 + 10));
|
||||
|
||||
for(;;){
|
||||
if(readn(ex, &d, Dirsz) != Dirsz)
|
||||
if(read(ex, &d.dirlen, 1) != 1)
|
||||
break;
|
||||
if(d.dirlen == 0)
|
||||
continue; /* zero padding to next sector */
|
||||
if(read(ex, &d.dirlen + 1, Dirsz-1) != Dirsz-1)
|
||||
break;
|
||||
if(readn(ex, name, d.namelen) != d.namelen)
|
||||
if(read(ex, name, d.namelen) != d.namelen)
|
||||
break;
|
||||
i = d.dirlen - (Dirsz + d.namelen);
|
||||
while(i-- > 0)
|
||||
read(ex, &c, 1);
|
||||
while(i-- > 0){
|
||||
if(read(ex, &c, 1) != 1)
|
||||
break;
|
||||
}
|
||||
for(i=0; i<d.namelen; i++){
|
||||
c = name[i];
|
||||
if(c >= 'A' && c <= 'Z'){
|
||||
|
|
Loading…
Reference in a new issue