]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
config: simplify code for permissions on regular files
authorSimon Ruderich <simon@ruderich.org>
Tue, 21 Oct 2025 04:58:56 +0000 (06:58 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 21 Oct 2025 04:58:56 +0000 (06:58 +0200)
cmd/safcm/config/files.go

index c049ad19c8e2dea8a4b0fc56cf27b4c687dc0010..9439ee39b27b8234668993ca9dc2d4243e658200 100644 (file)
@@ -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 {