Debian Codegraph @

internal/maincmd/writetest.go

raw symbols SCIP
1 package maincmd
2
3 import (
4 "fmt"
5 "os"
6 "path/filepath"
7 )
8
9 func canUnexpectedlyWriteTo(dir string) error {
10 fn := filepath.Join(dir, "gokr-rsyncd.unexpectedly_writable")
11 if err := os.WriteFile(fn, []byte("gokr-rsyncd creates this file to prevent misconfigurations. if you see this file, it means gokr-rsyncd unexpectedly was started with too many privileges"), 0644); err == nil {
12 os.Remove(fn)
13 return fmt.Errorf("unexpectedly able to write file to %s, exiting", dir)
14 }
15 return nil
16 }