cwfs: handle DMTMP flag in create
This commit is contained in:
parent
5c6a03f4f4
commit
5fc5c18208
3 changed files with 13 additions and 16 deletions
|
@ -894,8 +894,8 @@ fs_create(Chan* chan, Fcall* f, Fcall* r)
|
|||
error = Emode;
|
||||
goto out;
|
||||
}
|
||||
if(f->perm & PDIR)
|
||||
if((f->mode & OTRUNC) || (f->perm & PAPND) || (fmod & FWRITE))
|
||||
if(f->perm & DMDIR)
|
||||
if((f->mode & OTRUNC) || (f->perm & DMAPPEND) || (fmod & FWRITE))
|
||||
goto badaccess;
|
||||
/*
|
||||
* do it
|
||||
|
@ -921,20 +921,22 @@ fs_create(Chan* chan, Fcall* f, Fcall* r)
|
|||
d1->uid = file->uid;
|
||||
d1->gid = d->gid;
|
||||
f->perm &= d->mode | ~0666;
|
||||
if(f->perm & PDIR)
|
||||
if(f->perm & DMDIR)
|
||||
f->perm &= d->mode | ~0777;
|
||||
}
|
||||
d1->qid.path = path;
|
||||
d1->qid.version = 0;
|
||||
d1->mode = DALLOC | (f->perm & 0777);
|
||||
if(f->perm & PDIR) {
|
||||
if(f->perm & DMDIR) {
|
||||
d1->mode |= DDIR;
|
||||
d1->qid.path |= QPDIR;
|
||||
}
|
||||
if(f->perm & PAPND)
|
||||
if(f->perm & DMAPPEND)
|
||||
d1->mode |= DAPND;
|
||||
if(f->perm & DMTMP)
|
||||
d1->mode |= DTMP;
|
||||
t = nil;
|
||||
if(f->perm & PLOCK){
|
||||
if(f->perm & DMEXCL){
|
||||
d1->mode |= DLOCK;
|
||||
t = tlocked(p1, d1);
|
||||
/* if nil, out of tlock structures */
|
||||
|
|
|
@ -25,13 +25,6 @@ enum {
|
|||
QPROOT = 1,
|
||||
QPSUPER = 2,
|
||||
|
||||
/*
|
||||
* perm argument in 9P create
|
||||
*/
|
||||
PDIR = 1L<<31, /* is a directory */
|
||||
PAPND = 1L<<30, /* is append only */
|
||||
PLOCK = 1L<<29, /* is locked on open */
|
||||
|
||||
FID1 = 1,
|
||||
FID2 = 2,
|
||||
|
||||
|
|
|
@ -435,11 +435,13 @@ cmd_create(int argc, char *argv[])
|
|||
|
||||
if(argc > 5) {
|
||||
if(strchr(argv[5], 'l'))
|
||||
perm |= PLOCK;
|
||||
perm |= DMEXCL;
|
||||
if(strchr(argv[5], 'a'))
|
||||
perm |= PAPND;
|
||||
perm |= DMAPPEND;
|
||||
if(strchr(argv[5], 'd'))
|
||||
perm |= PDIR;
|
||||
perm |= DMDIR;
|
||||
if(strchr(argv[5], 't'))
|
||||
perm |= DMTMP;
|
||||
}
|
||||
|
||||
if(con_create(FID2, elem, uid, gid, perm, 0))
|
||||
|
|
Loading…
Reference in a new issue