Fix race condition of trying to write YAML config simultaneously and failing.

This commit is contained in:
Eugene Bujak 2018-11-29 13:31:50 +03:00
parent 942cde79bd
commit 2012e707d0

View file

@ -172,6 +172,8 @@ func parseConfig() error {
// Saves configuration to the YAML file and also saves the user filter contents to a file
func writeConfig() error {
c.Lock()
defer c.Unlock()
configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile)
yamlText, err := yaml.Marshal(&config)