ref: 24420ab9eb9124dd2ac032beacd84e4a2f6ddf56
parent: f8478eb4c4a60d0deb9eb3276540d74f1866f878
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;