URI: 
       tbreak from readdir properly (Lou Kamenov) - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit ca6a2d95acc005ef9a50e3f962ef0bbaa7876751
   DIR parent be8b4b397af631bad302ef2646477f228b4537b5
  HTML Author: rsc <devnull@localhost>
       Date:   Tue,  1 Aug 2006 14:38:30 +0000
       
       break from readdir properly (Lou Kamenov)
       
       Diffstat:
         M src/cmd/9pfuse/main.c               |      30 ++++++++++++++++--------------
       
       1 file changed, 16 insertions(+), 14 deletions(-)
       ---
   DIR diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c
       t@@ -825,24 +825,26 @@ fusereaddir(FuseMsg *m)
                p = buf;
                ep = buf + n;
                for(;;){
       -                if(ff->nd == 0){
       -                        free(ff->d0);
       -                        ff->d0 = nil;
       -                        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)){
       +                while(ff->nd > 0){
       +                        if(!canpack(ff->d, ff->off, &p, ep))
       +                                goto out;
                                ff->off++;
                                ff->d++;
                                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);
                free(buf);
        }