oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1//go:build linux
2
3package render
4
5import (
6 "fmt"
7 "os"
8 "path/filepath"
9)
10
11// openOut opens Render's output directory: an absolute, clean path to an
12// empty directory, mode 0700, owned by this user, reached through no
13// symlink (pinOutDir), held from then on by its descriptor.
14func openOut(dir string) (*os.Root, error) {
15 if !filepath.IsAbs(dir) || filepath.Clean(dir) != dir {
16 return nil, fmt.Errorf("render: output path %q", dir)
17 }
18 f, err := pinOutDir(dir)
19 if err != nil {
20 return nil, err
21 }
22 defer f.Close()
23 return os.OpenRoot(fmt.Sprintf("/proc/self/fd/%d", f.Fd()))
24}
25