Fix normal user with --rootless or --disable-agent have no permission to start

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
This commit is contained in:
JenTing Hsiao 2021-01-07 10:55:23 +08:00 committed by Brad Davidson
parent 6dabf7ac61
commit 3c7fd3d37b

View File

@ -57,7 +57,11 @@ func findDataDir() string {
}
dataDir := configfilearg.MustFindString(os.Args, "data-dir")
if dataDir == "" {
if os.Getuid() == 0 {
dataDir = datadir.DefaultDataDir
} else {
dataDir = datadir.DefaultHomeDataDir
}
logrus.Debug("Using default data dir in self-extracting wrapper")
}
return dataDir