devsrv, devshr: wstat permissions
update permissions last in wstat so it will only get changed when there was no error.
This commit is contained in:
parent
4b9845d942
commit
d7c7c7e4b3
|
@ -654,8 +654,6 @@ shrwstat(Chan *c, uchar *dp, int n)
|
|||
if(strcmp(ent->owner, up->user) && !iseve())
|
||||
error(Eperm);
|
||||
|
||||
if(d.mode != ~0UL)
|
||||
ent->perm = d.mode & 0777;
|
||||
if(d.name != nil && *d.name && strcmp(ent->name, d.name) != 0) {
|
||||
if(strchr(d.name, '/') != nil)
|
||||
error(Ebadchar);
|
||||
|
@ -665,6 +663,8 @@ shrwstat(Chan *c, uchar *dp, int n)
|
|||
}
|
||||
if(d.uid != nil && *d.uid)
|
||||
kstrdup(&ent->owner, d.uid);
|
||||
if(d.mode != ~0UL)
|
||||
ent->perm = d.mode & 0777;
|
||||
|
||||
switch(sch->level){
|
||||
case Qcshr:
|
||||
|
|
|
@ -272,8 +272,6 @@ srvwstat(Chan *c, uchar *dp, int n)
|
|||
if(strcmp(sp->owner, up->user) != 0 && !iseve())
|
||||
error(Eperm);
|
||||
|
||||
if(d.mode != ~0UL)
|
||||
sp->perm = d.mode & 0777;
|
||||
if(d.name != nil && *d.name && strcmp(sp->name, d.name) != 0) {
|
||||
if(strchr(d.name, '/') != nil)
|
||||
error(Ebadchar);
|
||||
|
@ -283,6 +281,8 @@ srvwstat(Chan *c, uchar *dp, int n)
|
|||
}
|
||||
if(d.uid != nil && *d.uid)
|
||||
kstrdup(&sp->owner, d.uid);
|
||||
if(d.mode != ~0UL)
|
||||
sp->perm = d.mode & 0777;
|
||||
|
||||
qunlock(&srvlk);
|
||||
poperror();
|
||||
|
|
Loading…
Reference in a new issue