From e8e51f92cad93709d67139967cb8a30567f1aac2 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 21 Oct 2025 06:58:56 +0200 Subject: [PATCH] config: simplify code for permissions on regular files --- cmd/safcm/config/files.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) 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 { -- 2.49.1