mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
source/kernel: silence misleading error on selinux detection
Silence a irrelevant error that was printed in case /sys/fs/selinux/ directory exists but selinuxfs is not mounted (i.e. the dir is empty).
This commit is contained in:
parent
c2e3de68f6
commit
ce66121d3c
1 changed files with 3 additions and 6 deletions
|
@ -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') {
|
||||
|
|
Loading…
Reference in a new issue