Suffix YayConf.BuildDir with uid to avoid permission issues between different users

This commit is contained in:
afg 2017-09-05 10:51:09 +08:00
parent 263b2facef
commit b3826dbb18

View file

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"os" "os"
"os/exec" "os/exec"
"os/user"
"strings" "strings"
alpm "github.com/jguer/go-alpm" alpm "github.com/jguer/go-alpm"
@ -119,7 +120,11 @@ func SaveConfig() error {
} }
func defaultSettings(config *Configuration) { 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.Editor = ""
config.Devel = false config.Devel = false
config.MakepkgBin = "/usr/bin/makepkg" config.MakepkgBin = "/usr/bin/makepkg"