avoid updating offset in pread; avoid diagnostic about vlong mask (charles forsyth)

This commit is contained in:
cinap_lenrek 2016-05-16 21:11:54 +02:00
parent 29c7ca80c9
commit b6005f3a45

View file

@ -677,10 +677,12 @@ read(int fd, uchar *p, long n, vlong *offp)
}else }else
nnn = nn = devtab[c->type]->read(c, p, n, off); nnn = nn = devtab[c->type]->read(c, p, n, off);
lock(c); if((c->qid.type & QTDIR) || offp == nil){
c->devoffset += nn; lock(c);
c->offset += nnn; c->devoffset += nn;
unlock(c); c->offset += nnn;
unlock(c);
}
poperror(); poperror();
cclose(c); cclose(c);
@ -1278,7 +1280,7 @@ packoldstat(uchar *buf, Dir *d)
p += 28; p += 28;
strncpy((char*)p, d->gid, 28); strncpy((char*)p, d->gid, 28);
p += 28; p += 28;
q = d->qid.path & ~DMDIR; /* make sure doesn't accidentally look like directory */ q = (ulong)d->qid.path & ~DMDIR; /* make sure doesn't accidentally look like directory */
if(d->qid.type & QTDIR) /* this is the real test of a new directory */ if(d->qid.type & QTDIR) /* this is the real test of a new directory */
q |= DMDIR; q |= DMDIR;
PBIT32(p, q); PBIT32(p, q);