From: Simon Ruderich Date: Tue, 21 Oct 2025 04:58:56 +0000 (+0200) Subject: config: simplify code for permissions on regular files X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=e8e51f92cad93709d67139967cb8a30567f1aac2;p=safcm%2Fsafcm.git config: simplify code for permissions on regular files --- diff --git a/cmd/safcm/config/files.go b/cmd/safcm/config/files.go index c049ad1..9439ee3 100644 --- a/cmd/safcm/config/files.go +++ b/cmd/safcm/config/files.go @@ -41,15 +41,11 @@ func LoadFiles(group string) (map[string]*safcm.File, error) { // Existing permissions of the files are not respected (except for +x // on regular files). if typ == 0 /* regular file */ { - if windows { - perm = 0644 - // 0755 must be set via permissions.yaml if windows is used - } else { - perm = 0644 - // Respect +x for files - if info.Mode().Perm()&0100 != 0 { - perm = 0755 - } + perm = 0644 + // Respect +x for files; except on windows where permissions.yaml + // must be used + if !windows && info.Mode().Perm()&0100 != 0 { + perm = 0755 } data, err = os.ReadFile(path) if err != nil {