diff options
Diffstat (limited to '')
-rw-r--r-- | misc/open_file.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/open_file.go b/misc/open_file.go index 2ee53db..5bc6067 100644 --- a/misc/open_file.go +++ b/misc/open_file.go @@ -29,7 +29,7 @@ func Open_file_at(dir Dir_t, filename string, flags int, perms os.FileMode) (*os // Open a file at or beneath the given directory. func Open_file_beneath(dir Dir_t, filename string, flags int, perms os.FileMode) (*os.File, error) { fd, err := Openat2(dir.fd, filename, &Open_how_t{ - Flags: uint64(flags), + Flags: uint64(flags)|syscall.O_CLOEXEC, Mode: uint64(syscallMode(perms)), Resolve: RESOLVE_BENEATH|RESOLVE_NO_SYMLINKS, }) @@ -47,7 +47,7 @@ func Open_file_beneath(dir Dir_t, filename string, flags int, perms os.FileMode) // Open a directory as read-only and return a Dir_t to it. The caller is // responsible for closing the directory with [Close_directory]. func Open_directory_readonly(path string) (Dir_t, error) { - _fd, err := syscall.Open(path, os.O_RDONLY|syscall.O_DIRECTORY, 0) + _fd, err := syscall.Open(path, syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_CLOEXEC, 0) return Dir_t{fd: _fd, name: path}, err } |