Skip to content
Snippets Groups Projects
Commit 400e6b68 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Gopher Robot
Browse files

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: default avatarTobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: default avatarCherry Mui <cherryyz@google.com>
Reviewed-by: default avatarIan Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
parent 4f18477d
No related branches found
No related tags found
No related merge requests found
...@@ -306,7 +306,7 @@ func openDirNolog(name string) (*File, error) { ...@@ -306,7 +306,7 @@ func openDirNolog(name string) (*File, error) {
e error e error
) )
ignoringEINTR(func() 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 return e
}) })
if e != nil { if e != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment