aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-09-29 18:20:00 +0530
committerAditya R <arajan@redhat.com>2022-09-29 18:20:03 +0530
commitf00ceaabd497e87415f6926de50478260cd7e844 (patch)
treee7eda66523349d0fe7184da5e1bb2fbc736d9ff6 /vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
parentb7eee0b2ce1eb19804ebed6184d0ad2a4bd91fb9 (diff)
downloadpodman-f00ceaabd497e87415f6926de50478260cd7e844.tar.gz
podman-f00ceaabd497e87415f6926de50478260cd7e844.tar.bz2
podman-f00ceaabd497e87415f6926de50478260cd7e844.zip
vendor: bump c/common to v0.49.2-0.20220929111928-2d1b45ae2423
[NO NEW TESTS NEEDED] [NO TESTS NEEDED] Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go')
-rw-r--r--vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go b/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
index feb739d32..8bff29355 100644
--- a/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
+++ b/vendor/github.com/opencontainers/selinux/go-selinux/rchcon.go
@@ -1,3 +1,4 @@
+//go:build linux && go1.16
// +build linux,go1.16
package selinux
@@ -11,7 +12,18 @@ import (
)
func rchcon(fpath, label string) error {
+ fastMode := false
+ // If the current label matches the new label, assume
+ // other labels are correct.
+ if cLabel, err := lFileLabel(fpath); err == nil && cLabel == label {
+ fastMode = true
+ }
return pwalkdir.Walk(fpath, func(p string, _ fs.DirEntry, _ error) error {
+ if fastMode {
+ if cLabel, err := lFileLabel(fpath); err == nil && cLabel == label {
+ return nil
+ }
+ }
e := lSetFileLabel(p, label)
// Walk a file tree can race with removal, so ignore ENOENT.
if errors.Is(e, os.ErrNotExist) {