nigifabio / go9p

Automatically exported from code.google.com/p/go9p
Other
0 stars 0 forks source link

srv.read() doesn't reset fid.DirOffset #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Read from a dir at Offset = 0 twice and you will get Ebadoffset instead of 
rewinding the directory read.

diff -r 06555e13d0bc p/srv/fcall.go
--- a/p/srv/fcall.go    Thu Nov 11 13:37:20 2010 -0700
+++ b/p/srv/fcall.go    Mon Nov 15 10:44:55 2010 -0800
@@ -326,9 +326,13 @@
        return
    }

-   if (fid.Type&p.QTDIR) != 0 && tc.Offset > 0 && tc.Offset != fid.Diroffset {
-       req.RespondError(Ebadoffset)
-       return
+   if (fid.Type&p.QTDIR) != 0 {
+       if tc.Offset == 0 {
+           fid.Diroffset = 0
+       } else if tc.Offset != fid.Diroffset {
+           req.RespondError(Ebadoffset)
+           return
+       }
    }

    (req.Conn.Srv.ops).(ReqOps).Read(req)

Original issue reported on code.google.com by dadk...@gmail.com on 15 Nov 2010 at 6:46

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 7d0d1ffd4e.

Original comment by mirtchov...@gmail.com on 15 Nov 2010 at 7:07

GoogleCodeExporter commented 9 years ago
thanks. it's applied.

Original comment by mirtchov...@gmail.com on 15 Nov 2010 at 7:09