1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
Sebastiaan van Stijn 9880e6a1ef
vendor: github.com/opencontainers/selinux v1.10.1
- relabel links instead of their targets

full diff: https://github.com/opencontainers/selinux/compare/v1.10.0...v1.10.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-05-02 14:40:47 +02:00

22 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
})
}