From b6005f3a457ff1b40b5fd342c63e2685e5f49b1c Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 16 May 2016 21:11:54 +0200 Subject: [PATCH] avoid updating offset in pread; avoid diagnostic about vlong mask (charles forsyth) --- sys/src/9/port/sysfile.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/src/9/port/sysfile.c b/sys/src/9/port/sysfile.c index 451822917..4a36951c9 100644 --- a/sys/src/9/port/sysfile.c +++ b/sys/src/9/port/sysfile.c @@ -677,10 +677,12 @@ read(int fd, uchar *p, long n, vlong *offp) }else nnn = nn = devtab[c->type]->read(c, p, n, off); - lock(c); - c->devoffset += nn; - c->offset += nnn; - unlock(c); + if((c->qid.type & QTDIR) || offp == nil){ + lock(c); + c->devoffset += nn; + c->offset += nnn; + unlock(c); + } poperror(); cclose(c); @@ -1278,7 +1280,7 @@ packoldstat(uchar *buf, Dir *d) p += 28; strncpy((char*)p, d->gid, 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 */ q |= DMDIR; PBIT32(p, q);