hjfs: dont mask permission bits for "create" console command

This commit is contained in:
cinap_lenrek 2013-01-13 08:49:31 +01:00
parent 6dc133ad99
commit 63f1fc07eb
2 changed files with 8 additions and 6 deletions

View file

@ -148,7 +148,7 @@ cmdcreate(int argc, char **argv)
return -1;
if(name2uid(fsmain, argv[3], &gid) < 0)
return -1;
ch = chanattach(fsmain, 0);
ch = chanattach(fsmain, CHFNOPERM);
if(ch == nil)
return -1;
ch->uid = uid;

View file

@ -132,17 +132,19 @@ chancreat(Chan *ch, char *name, int perm, int mode)
werrstr(Enotadir);
goto error;
}
if((ch->flags & CHFNOPERM) == 0)
if((ch->flags & CHFNOPERM) == 0){
if(!permcheck(ch->fs, d, ch->uid, OWRITE)){
werrstr(Eperm);
goto error;
}
if(isdir)
perm &= ~0777 | d->mode & 0777;
else
perm &= ~0666 | d->mode & 0666;
}
if(newentry(ch->fs, ch->loc, b, name, &f, 0) <= 0)
goto error;
if(isdir)
perm &= ~0777 | d->mode & 0777;
else
perm &= ~0666 | d->mode & 0666;
f.type = perm >> 24;
if(newqid(ch->fs, &f.path) < 0)
goto error;