1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-01-21 06:48:35 +00:00
restic/internal/fs/meta_darwin.go
2024-11-30 19:17:25 +01:00

25 lines
406 B
Go

package fs
import (
"os"
"golang.org/x/sys/unix"
)
func openMetadataHandle(path string, flag int) (*os.File, error) {
flags := O_RDONLY
if flag&O_NOFOLLOW != 0 {
// open symlink instead of following it
flags |= unix.O_SYMLINK
}
if flag&O_DIRECTORY != 0 {
flags |= O_DIRECTORY
}
f, err := os.OpenFile(path, flags, 0)
if err != nil {
return nil, err
}
_ = setFlags(f)
return f, nil
}