aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/syscallcompat/open_nofollow.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/internal/syscallcompat/open_nofollow.go b/internal/syscallcompat/open_nofollow.go
index db39415..a1e7cce 100644
--- a/internal/syscallcompat/open_nofollow.go
+++ b/internal/syscallcompat/open_nofollow.go
@@ -23,8 +23,7 @@ func OpenDirNofollow(baseDir string, relPath string) (fd int, err error) {
return -1, syscall.EINVAL
}
// Open the base dir (following symlinks)
- // TODO: should this use syscallcompat.O_PATH?
- dirfd, err := syscall.Open(baseDir, syscall.O_RDONLY|syscall.O_DIRECTORY, 0)
+ dirfd, err := syscall.Open(baseDir, syscall.O_DIRECTORY|O_PATH, 0)
if err != nil {
return -1, err
}
@@ -37,7 +36,7 @@ func OpenDirNofollow(baseDir string, relPath string) (fd int, err error) {
// Walk the directory tree
var dirfd2 int
for _, name := range parts {
- dirfd2, err = Openat(dirfd, name, syscall.O_RDONLY|syscall.O_NOFOLLOW|syscall.O_DIRECTORY|O_PATH, 0)
+ dirfd2, err = Openat(dirfd, name, syscall.O_NOFOLLOW|syscall.O_DIRECTORY|O_PATH, 0)
syscall.Close(dirfd)
if err != nil {
return -1, err