mirror of https://github.com/golang/go.git
os: openDir: add O_DIRECTORY flag for unix
With this, ReadDir will fail a tad earlier (on open rather than on readdir syscall). This should be the only effect of this change. Change-Id: Icf2870f47ea6c19aad29670e78ba9bfcc13c0ac3 Reviewed-on: https://go-review.googlesource.com/c/go/+/588915 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
4f18477db6
commit
400e6b68b5
|
|
@ -306,7 +306,7 @@ func openDirNolog(name string) (*File, error) {
|
|||
e error
|
||||
)
|
||||
ignoringEINTR(func() error {
|
||||
r, s, e = open(name, O_RDONLY|syscall.O_CLOEXEC, 0)
|
||||
r, s, e = open(name, O_RDONLY|syscall.O_CLOEXEC|syscall.O_DIRECTORY, 0)
|
||||
return e
|
||||
})
|
||||
if e != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue