예제 #1
0
파일: xattr_linux.go 프로젝트: NERSC/docker
func Getxattr(path, attr string) (string, error) {
	value, err := system.Lgetxattr(path, attr)
	if err != nil {
		return "", err
	}
	return string(value), nil
}
예제 #2
0
// Getfilecon returns the SELinux label for this path or returns an error.
func Getfilecon(path string) (string, error) {
	con, err := system.Lgetxattr(path, xattrNameSelinux)

	// Trim the NUL byte at the end of the byte buffer, if present.
	if con[len(con)-1] == '\x00' {
		con = con[:len(con)-1]
	}
	return string(con), err
}
예제 #3
0
파일: selinux.go 프로젝트: baoruxing/docker
// Return the SELinux label for this path
func Getfilecon(path string) (string, error) {
	con, err := system.Lgetxattr(path, xattrNameSelinux)
	return string(con), err
}