]> Cypherpunks repositories - gostls13.git/commitdiff
os: plan9 seek() should invalidate cached directory info
authorKeith Randall <khr@golang.org>
Mon, 2 Mar 2020 01:40:35 +0000 (17:40 -0800)
committerKeith Randall <khr@golang.org>
Mon, 2 Mar 2020 05:20:50 +0000 (05:20 +0000)
Update #37161

Change-Id: Iee828bbcc8436af29ca6dd9ed897cb5265a57cf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/221778
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
src/os/file_plan9.go

index 48bf5f5076a67e0fc95c756c97d2a33714385a5c..bcf3c625bf1da2ed84c985e0027b08d7649dcd39 100644 (file)
@@ -290,6 +290,11 @@ func (f *File) pwrite(b []byte, off int64) (n int, err error) {
 // relative to the current offset, and 2 means relative to the end.
 // It returns the new offset and an error, if any.
 func (f *File) seek(offset int64, whence int) (ret int64, err error) {
+       if f.dirinfo != nil {
+               // Free cached dirinfo, so we allocate a new one if we
+               // access this file as a directory again. See #35767 and #37161.
+               f.dirinfo = nil
+       }
        return syscall.Seek(f.fd, offset, whence)
 }