File: rchcon_go115.go

package info (click to toggle)
golang-github-opencontainers-selinux 1.10.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, bookworm-proposed-updates
  • size: 272 kB
  • sloc: makefile: 31
file content (21 lines) | stat: -rw-r--r-- 396 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// +build linux,!go1.16

package selinux

import (
	"errors"
	"os"

	"github.com/opencontainers/selinux/pkg/pwalk"
)

func rchcon(fpath, label string) error {
	return pwalk.Walk(fpath, func(p string, _ os.FileInfo, _ error) error {
		e := setFileLabel(p, label)
		// Walk a file tree can race with removal, so ignore ENOENT.
		if errors.Is(e, os.ErrNotExist) {
			return nil
		}
		return e
	})
}