MCPcopy Create free account
hub / github.com/tailscale/tailscale / ensureStateDirPermsUnix

Function ensureStateDirPermsUnix

paths/paths_unix.go:74–91  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

72}
73
74func ensureStateDirPermsUnix(dir string) error {
75 if filepath.Base(dir) != "tailscale" {
76 return nil
77 }
78 fi, err := os.Stat(dir)
79 if err != nil {
80 return err
81 }
82 if !fi.IsDir() {
83 return fmt.Errorf("expected %q to be a directory; is %v", dir, fi.Mode())
84 }
85 const perm = 0700
86 if fi.Mode().Perm() == perm {
87 // Already correct.
88 return nil
89 }
90 return os.Chmod(dir, perm)
91}

Callers

nothing calls this directly

Calls 5

ModeMethod · 0.80
StatMethod · 0.65
ErrorfMethod · 0.65
ChmodMethod · 0.65
IsDirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…