Skip to content

Commit

Permalink
Merge pull request #1694 from marquiz/devel/selinux
Browse files Browse the repository at this point in the history
source/kernel: silence misleading error on selinux detection
  • Loading branch information
k8s-ci-robot authored May 6, 2024
2 parents b9770b1 + ce66121 commit b608451
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions source/kernel/selinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ func SelinuxEnabled() (bool, error) {
return false, err
}

selinuxBase := filepath.Join(sysfsBase, "selinux")
if _, err := os.Stat(selinuxBase); os.IsNotExist(err) {
status, err := os.ReadFile(filepath.Join(sysfsBase, "selinux", "enforce"))
if os.IsNotExist(err) {
klog.V(1).InfoS("selinux not available on the system")
return false, nil
}

status, err := os.ReadFile(filepath.Join(selinuxBase, "enforce"))
if err != nil {
} else if err != nil {
return false, err
}
if status[0] == byte('1') {
Expand Down

0 comments on commit b608451

Please sign in to comment.