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>
This commit is contained in:
parent
d3a10b4983
commit
fb0e9e3e41
1 changed files with 5 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue