Skip to content

Commit 400e6b6

Browse files
kolyshkingopherbot
authored andcommitted
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 <[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]>
1 parent 4f18477 commit 400e6b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/os/file_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func openDirNolog(name string) (*File, error) {
306306
e error
307307
)
308308
ignoringEINTR(func() error {
309-
r, s, e = open(name, O_RDONLY|syscall.O_CLOEXEC, 0)
309+
r, s, e = open(name, O_RDONLY|syscall.O_CLOEXEC|syscall.O_DIRECTORY, 0)
310310
return e
311311
})
312312
if e != nil {

0 commit comments

Comments
 (0)