diff options
author | Connor Kuehl <cipkuehl@gmail.com> | 2022-04-14 05:54:26 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-04-14 23:48:24 +0200 |
commit | fb0e9e3e41cd263de139de0bf620cc69ee5d61ae (patch) | |
tree | 7f35c77324b970e6146cff6f57ece3dd9df81ccb /config | |
parent | d3a10b49834a9cb24411f8af3e68a4f8ea186152 (diff) | |
download | aerc-fb0e9e3e41cd263de139de0bf620cc69ee5d61ae.tar.gz |
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')
-rw-r--r-- | config/config.go | 6 |
1 files changed, 5 insertions, 1 deletions
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 { |