}
wlock(fp);
+ if(fp->parent == nil){
+ wunlock(fp);
+ werrstr("create in deleted directory");
+ return nil;
+ }
+
/*
* We might encounter blank spots along the
* way due to deleted files that have not yet
if(perm & DMEXCL)
f->qid.type |= QTEXCL;
- f->mode = perm;
f->atime = f->mtime = time(0);
f->length = 0;
f->parent = fp;
rlock(dir);
if(strcmp(elem, "..") == 0){
fp = dir->parent;
- incref(fp);
+ if(fp != nil)
+ incref(fp);
runlock(dir);
closefile(dir);
return fp;
}
long
-readdirfile(Readdir *r, uchar *buf, long n)
+readdirfile(Readdir *r, uchar *buf, long n, long o)
{
long x, m;
Filelist *fl;
- for(fl=r->fl, m=0; fl && m+2<=n; fl=fl->link, m+=x){
+ if(o == 0)
+ fl = r->dir->filelist;
+ else
+ fl = r->fl;
+ for(m=0; fl && m+2<=n; fl=fl->link, m+=x){
if(fl->f == nil)
x = 0;
else if((x=convD2M(fl->f, buf+m, n-m)) <= BIT16SZ)