From f75c47d9cac17d25d7987bf703107df4253b92a3 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Tue, 26 Jul 2016 16:57:26 -0700 Subject: [PATCH] Always store files in ~/.certspotter, even if running as root --- cmd/common.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/cmd/common.go b/cmd/common.go index b3a06a3..2b23bbf 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -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,19 +52,11 @@ func homedir () string { } func DefaultStateDir (programName string) string { - if isRoot() { - return filepath.Join("/var/lib", programName) - } else { - return filepath.Join(homedir(), "." + programName) - } + return filepath.Join(homedir(), "." + programName) } func DefaultConfigDir (programName string) string { - if isRoot() { - return filepath.Join("/etc", programName) - } else { - return filepath.Join(homedir(), "." + programName) - } + return filepath.Join(homedir(), "." + programName) } func LogEntry (info *certspotter.EntryInfo) {