]> Cypherpunks repositories - gostls13.git/commit
os: reset dirinfo when seeking on Darwin
authorKeith Randall <khr@golang.org>
Wed, 4 Dec 2019 22:58:04 +0000 (14:58 -0800)
committerKeith Randall <khr@golang.org>
Thu, 5 Dec 2019 20:40:38 +0000 (20:40 +0000)
commite3c7ffcd957785bc9d3e1f2db9219bd74a96bbb1
tree4fa3ddebcbd6746b73109b8d06b28a4f66057ce8
parentd72dce87837c96f875d5fa2e26159ef211bce3a0
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>
src/os/dir_darwin.go
src/os/dir_unix.go
src/os/file_unix.go
src/syscall/fs_js.go
test/fixedbugs/issue35767.go [new file with mode: 0644]