Omit syscall.O_RDONLY flag when passing O_PATH.
When O_PATH is specified in flags, flag bits other than O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW are ignored.
This commit is contained in:
parent
0414ef2572
commit
a1ba4b6576
@ -99,7 +99,7 @@ func initDir(args *argContainer) {
|
||||
// in the root dir
|
||||
if !args.plaintextnames && !args.reverse {
|
||||
// Open cipherdir (following symlinks)
|
||||
dirfd, err := syscall.Open(args.cipherdir, syscall.O_RDONLY|syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
dirfd, err := syscall.Open(args.cipherdir, syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
if err == nil {
|
||||
err = nametransform.WriteDirIVAt(dirfd)
|
||||
syscall.Close(dirfd)
|
||||
|
@ -42,7 +42,7 @@ func (fs *FS) openBackingDir(relPath string) (dirfd int, cName string, err error
|
||||
return dirfd, cName, nil
|
||||
}
|
||||
// Open cipherdir (following symlinks)
|
||||
dirfd, err = syscall.Open(fs.args.Cipherdir, syscall.O_RDONLY|syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
dirfd, err = syscall.Open(fs.args.Cipherdir, syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
if err != nil {
|
||||
return -1, "", err
|
||||
}
|
||||
@ -65,7 +65,7 @@ func (fs *FS) openBackingDir(relPath string) (dirfd int, cName string, err error
|
||||
break
|
||||
}
|
||||
// Not the last part? Descend into next directory.
|
||||
dirfd2, err := syscallcompat.Openat(dirfd, cName, syscall.O_RDONLY|syscall.O_NOFOLLOW|syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
dirfd2, err := syscallcompat.Openat(dirfd, cName, syscall.O_NOFOLLOW|syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
syscall.Close(dirfd)
|
||||
if err != nil {
|
||||
return -1, "", err
|
||||
|
@ -114,7 +114,7 @@ func ResetTmpDir(createDirIV bool) {
|
||||
}
|
||||
if createDirIV {
|
||||
// Open cipherdir (following symlinks)
|
||||
dirfd, err := syscall.Open(DefaultCipherDir, syscall.O_RDONLY|syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
dirfd, err := syscall.Open(DefaultCipherDir, syscall.O_DIRECTORY|syscallcompat.O_PATH, 0)
|
||||
if err == nil {
|
||||
err = nametransform.WriteDirIVAt(dirfd)
|
||||
syscall.Close(dirfd)
|
||||
|
Loading…
Reference in New Issue
Block a user