mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-10-12 01:58:46 +02:00
23 lines
663 B
Go
23 lines
663 B
Go
//go:build !windows
|
|
|
|
package cli
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
// hasElevatedPrivilege checks if the current process has elevated privileges
|
|
func hasElevatedPrivilege() (bool, error) {
|
|
return os.Geteuid() == 0, nil
|
|
}
|
|
|
|
// openLogFile opens a log file. It refuses a symlink, because ctrld often
|
|
// writes its logs as root into a directory that other users can write.
|
|
func openLogFile(path string, flags int) (*os.File, error) {
|
|
return os.OpenFile(path, flags|syscall.O_NOFOLLOW, os.FileMode(0o600))
|
|
}
|
|
|
|
// ConfigureWindowsServiceFailureActions is a no-op on non-Windows platforms
|
|
func ConfigureWindowsServiceFailureActions(serviceName string) error { return nil }
|