//go:build linux package render import ( "fmt" "os" "path/filepath" ) // openOut opens Render's output directory: an absolute, clean path to an // empty directory, mode 0700, owned by this user, reached through no // symlink (pinOutDir), held from then on by its descriptor. func openOut(dir string) (*os.Root, error) { if !filepath.IsAbs(dir) || filepath.Clean(dir) != dir { return nil, fmt.Errorf("render: output path %q", dir) } f, err := pinOutDir(dir) if err != nil { return nil, err } defer f.Close() return os.OpenRoot(fmt.Sprintf("/proc/self/fd/%d", f.Fd())) }