summaryrefslogtreecommitdiff
path: root/config/config.go
diff options
context:
space:
mode:
authorConnor Kuehl <cipkuehl@gmail.com>2022-04-14 05:54:26 -0500
committerRobin Jarry <robin@jarry.cc>2022-04-14 23:48:24 +0200
commitfb0e9e3e41cd263de139de0bf620cc69ee5d61ae (patch)
tree7f35c77324b970e6146cff6f57ece3dd9df81ccb /config/config.go
parentd3a10b49834a9cb24411f8af3e68a4f8ea186152 (diff)
downloadaerc-fb0e9e3e41cd263de139de0bf620cc69ee5d61ae.zip
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 <cipkuehl@gmail.com> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/config/config.go b/config/config.go
index 2120310..f8b2f65 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 {