mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
os: reset dirinfo when seeking on Darwin
The first Readdirnames calls opendir and caches the result. The behavior of that cached opendir result isn't specified on a seek of the underlying fd. Free the opendir result on a seek so that we'll allocate a new one the next time around. Also fix wasm behavior in this regard, so that a seek to the file start resets the Readdirnames position, regardless of platform. p.s. I hate the Readdirnames API. Fixes #35767. Change-Id: Ieffb61b3c5cdd42591f69ab13f932003966f2297 Reviewed-on: https://go-review.googlesource.com/c/go/+/209961 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
d72dce8783
commit
e3c7ffcd95
5 changed files with 69 additions and 3 deletions
|
|
@ -26,6 +26,8 @@ const (
|
|||
|
||||
func (d *dirInfo) close() {}
|
||||
|
||||
func (f *File) seekInvalidate() {}
|
||||
|
||||
func (f *File) readdirnames(n int) (names []string, err error) {
|
||||
// If this file has no dirinfo, create one.
|
||||
if f.dirinfo == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue