mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-30 00:11:59 +00:00
a34a571d2e
Signed-off-by: Evan Lezar <elezar@nvidia.com>
23 lines
411 B
Go
23 lines
411 B
Go
// +build linux,go1.16
|
|
|
|
package selinux
|
|
|
|
import (
|
|
"errors"
|
|
"io/fs"
|
|
"os"
|
|
|
|
"github.com/opencontainers/selinux/pkg/pwalkdir"
|
|
)
|
|
|
|
func rchcon(fpath, label string) error {
|
|
return pwalkdir.Walk(fpath, func(p string, _ fs.DirEntry, _ error) error {
|
|
e := lSetFileLabel(p, label)
|
|
// Walk a file tree can race with removal, so ignore ENOENT.
|
|
if errors.Is(e, os.ErrNotExist) {
|
|
return nil
|
|
}
|
|
return e
|
|
})
|
|
}
|