From fb0e9e3e41cd263de139de0bf620cc69ee5d61ae Mon Sep 17 00:00:00 2001 From: Connor Kuehl Date: Thu, 14 Apr 2022 05:54:26 -0500 Subject: config: don't swallow error in checkConfigPerms os.Stat might return other errors aside from one stating that the file does not exist. If it does, propagate the error down. As before, if the file does not exist, just do nothing. Signed-off-by: Connor Kuehl Reviewed-by: Moritz Poldrack Tested-by: Moritz Poldrack --- config/config.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/config.go b/config/config.go index 2120310d..f8b2f650 100644 --- a/config/config.go +++ b/config/config.go @@ -852,9 +852,13 @@ func (config *AercConfig) LoadBinds(binds *ini.File, baseName string, baseGroup // printing the fix on stdout and returning an error func checkConfigPerms(filename string) error { info, err := os.Stat(filename) - if err != nil { + if errors.Is(err, os.ErrNotExist) { return nil // disregard absent files } + if err != nil { + return err + } + perms := info.Mode().Perm() // group or others have read access if perms&044 != 0 { -- cgit