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:
cinap_lenrek 2013-06-18 22:09:40 +02:00
parent 4b9845d942
commit d7c7c7e4b3
2 changed files with 4 additions and 4 deletions

View file

@ -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:

View file

@ -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();