Always store files in ~/.certspotter, even if running as root

This commit is contained in:
Andrew Ayer 2016-07-26 16:57:26 -07:00
parent c185657181
commit f75c47d9ca
1 changed files with 2 additions and 14 deletions

View File

@ -39,10 +39,6 @@ var stateDir string
var printMutex sync.Mutex
func isRoot () bool {
return os.Geteuid() == 0
}
func homedir () string {
home := os.Getenv("HOME")
if home != "" {
@ -56,20 +52,12 @@ func homedir () string {
}
func DefaultStateDir (programName string) string {
if isRoot() {
return filepath.Join("/var/lib", programName)
} else {
return filepath.Join(homedir(), "." + programName)
}
}
func DefaultConfigDir (programName string) string {
if isRoot() {
return filepath.Join("/etc", programName)
} else {
return filepath.Join(homedir(), "." + programName)
}
}
func LogEntry (info *certspotter.EntryInfo) {
if !*noSave {