Skip to content

Commit

Permalink
os: openDir: add O_DIRECTORY flag for unix
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Tobias Klauser <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
  • Loading branch information
kolyshkin authored and gopherbot committed Aug 22, 2024
1 parent 4f18477 commit 400e6b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/os/file_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 400e6b6

Please sign in to comment.