summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/sysfile.c12
1 files 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);