summaryrefslogtreecommitdiff
path: root/sys/src/9/port/sysfile.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-04-30 01:51:07 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2017-04-30 01:51:07 +0200
commit24420ab9eb9124dd2ac032beacd84e4a2f6ddf56 (patch)
tree508d463cd842f948b7a009eb95e17b3e1118d436 /sys/src/9/port/sysfile.c
parentf8478eb4c4a60d0deb9eb3276540d74f1866f878 (diff)
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.
Diffstat (limited to 'sys/src/9/port/sysfile.c')
-rw-r--r--sys/src/9/port/sysfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/src/9/port/sysfile.c b/sys/src/9/port/sysfile.c
index 4a36951c9..ed8e5c7ad 100644
--- a/sys/src/9/port/sysfile.c
+++ b/sys/src/9/port/sysfile.c
@@ -655,7 +655,7 @@ read(int fd, uchar *p, long n, vlong *offp)
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 @@ read(int fd, uchar *p, long n, vlong *offp)
}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;