lib9p/hjfs: use x != ~0 instead (type)~x conditionals to work arround arm compiler issue

This commit is contained in:
cinap_lenrek 2013-10-02 01:36:05 +02:00
parent da2d0ee780
commit 505bc9b491
2 changed files with 10 additions and 10 deletions

View file

@ -716,16 +716,16 @@ chanwstat(Chan *ch, Dir *di)
ingroup(ch->fs, ch->uid, d->gid, 1) ||
(ch->fs->flags & FSNOPERM) != 0 ||
(ch->flags & CHFNOPERM) != 0;
if((uvlong)~di->length){
if(di->length != ~0){
if(isdir && di->length != 0)
goto inval;
if((ch->flags & CHFNOPERM) == 0)
if(di->length != d->size && !permcheck(ch->fs, d, ch->uid, OWRITE))
goto perm;
}
if((ulong)~di->mtime && !owner)
if(di->mtime != ~0 && !owner)
goto perm;
if((ulong)~di->mode && !owner)
if(di->mode != ~0 && !owner)
goto perm;
nuid = NOUID;
ngid = NOUID;
@ -737,13 +737,13 @@ chanwstat(Chan *ch, Dir *di)
goto inval;
if((nuid != NOUID || ngid != NOUID) && !owner)
goto perm;
if((uvlong)~di->length && !isdir){
if(di->length != ~0 && !isdir){
trunc(ch->fs, ch->loc, b, di->length);
modified(ch, d);
}
if((ulong)~di->mtime)
if(di->mtime != ~0)
d->mtime = di->mtime;
if((ulong)~di->mode){
if(di->mode != ~0){
d->mode = d->mode & ~0777 | di->mode & 0777;
ch->loc->type = d->type = di->mode >> 24;
}

View file

@ -668,15 +668,15 @@ swstat(Srv *srv, Req *r)
respond(r, Ebaddir);
return;
}
if((ushort)~r->d.type){
if(r->d.type != (ushort)~0){
respond(r, "wstat -- attempt to change type");
return;
}
if((uint)~r->d.dev){
if(r->d.dev != ~0){
respond(r, "wstat -- attempt to change dev");
return;
}
if((uchar)~r->d.qid.type || (ulong)~r->d.qid.vers || (uvlong)~r->d.qid.path){
if(r->d.qid.type != (uchar)~0 || r->d.qid.vers != ~0 || r->d.qid.path != ~0){
respond(r, "wstat -- attempt to change qid");
return;
}
@ -684,7 +684,7 @@ swstat(Srv *srv, Req *r)
respond(r, "wstat -- attempt to change muid");
return;
}
if((ulong)~r->d.mode && ((r->d.mode&DMDIR)>>24) != (r->fid->qid.type&QTDIR)){
if(r->d.mode != ~0 && ((r->d.mode&DMDIR)>>24) != (r->fid->qid.type&QTDIR)){
respond(r, "wstat -- attempt to change DMDIR bit");
return;
}