break from readdir properly (Lou Kamenov)
This commit is contained in:
parent
be8b4b397a
commit
ca6a2d95ac
1 changed files with 16 additions and 14 deletions
|
|
@ -825,24 +825,26 @@ fusereaddir(FuseMsg *m)
|
||||||
p = buf;
|
p = buf;
|
||||||
ep = buf + n;
|
ep = buf + n;
|
||||||
for(;;){
|
for(;;){
|
||||||
if(ff->nd == 0){
|
while(ff->nd > 0){
|
||||||
free(ff->d0);
|
if(!canpack(ff->d, ff->off, &p, ep))
|
||||||
ff->d0 = nil;
|
goto out;
|
||||||
ff->d = nil;
|
|
||||||
if((ff->nd = fsdirread(ff->fid, &ff->d0)) < 0){
|
|
||||||
replyfuseerrstr(m);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(ff->nd == 0)
|
|
||||||
break;
|
|
||||||
ff->d = ff->d0;
|
|
||||||
}
|
|
||||||
while(ff->nd > 0 && canpack(ff->d, ff->off, &p, ep)){
|
|
||||||
ff->off++;
|
ff->off++;
|
||||||
ff->d++;
|
ff->d++;
|
||||||
ff->nd--;
|
ff->nd--;
|
||||||
}
|
}
|
||||||
}
|
free(ff->d0);
|
||||||
|
ff->d0 = nil;
|
||||||
|
ff->d = nil;
|
||||||
|
if((ff->nd = fsdirread(ff->fid, &ff->d0)) < 0){
|
||||||
|
replyfuseerrstr(m);
|
||||||
|
free(buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(ff->nd == 0)
|
||||||
|
break;
|
||||||
|
ff->d = ff->d0;
|
||||||
|
}
|
||||||
|
out:
|
||||||
replyfuse(m, buf, p - buf);
|
replyfuse(m, buf, p - buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue