From b3826dbb181722cff7b0617a5fc4d245edaf4aa2 Mon Sep 17 00:00:00 2001 From: afg Date: Tue, 5 Sep 2017 10:51:09 +0800 Subject: [PATCH] Suffix YayConf.BuildDir with uid to avoid permission issues between different users --- config/config.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 6cd6360f..e17b0fe0 100644 --- a/config/config.go +++ b/config/config.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "os/exec" + "os/user" "strings" alpm "github.com/jguer/go-alpm" @@ -119,7 +120,11 @@ func SaveConfig() error { } func defaultSettings(config *Configuration) { - config.BuildDir = "/tmp/yaytmp/" + u, err := user.Current() + if err != nil { + panic(err) + } + config.BuildDir = fmt.Sprintf("/tmp/yaytmp-%s/", u.Uid) config.Editor = "" config.Devel = false config.MakepkgBin = "/usr/bin/makepkg"