ref: 2e600e6b000ff90bd5a697761b5f00d2bd2cf2de
parent: be7893e0e4fc97d210630791df4d20b60196d81f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Apr 29 21:51:07 EDT 2017
kernel: fix rewinding in directories with pread() offset reading directories with pread() offset has to work the same way as read(), otherwise exportfs breaks rewinding in directories.
--- a/sys/src/9/port/sysfile.c
+++ b/sys/src/9/port/sysfile.c
@@ -655,7 +655,7 @@
error(Enegoff);
if(off == 0){ /* rewind to the beginning of the directory */- if(offp == nil){+ if(offp == nil || (c->qid.type & QTDIR)){c->offset = 0;
c->devoffset = 0;
}
@@ -677,7 +677,7 @@
}else
nnn = nn = devtab[c->type]->read(c, p, n, off);
- if((c->qid.type & QTDIR) || offp == nil){+ if(offp == nil || (c->qid.type & QTDIR)){lock(c);
c->devoffset += nn;
c->offset += nnn;
--
⑨