diff --git a/label/label_selinux.go b/label/label_selinux.go index 7bc40ddd..c8fba845 100644 --- a/label/label_selinux.go +++ b/label/label_selinux.go @@ -105,14 +105,14 @@ func Relabel(path string, fileLabel string, relabel string) error { if fileLabel == "" { return nil } + if !strings.ContainsAny(relabel, "zZ") { + return nil + } for _, p := range exclude_path { if path == p { return fmt.Errorf("Relabeling of %s is not allowed", path) } } - if !strings.ContainsAny(relabel, "zZ") { - return nil - } if strings.Contains(relabel, "z") && strings.Contains(relabel, "Z") { return fmt.Errorf("Bad SELinux option z and Z can not be used together") }