func Getfilecon(path string) (string, error) { var scon C.security_context_t var fcon string rc, err := C.lgetfilecon(C.CString(path), &scon) if rc >= 0 { fcon = C.GoString(scon) err = nil } return fcon, err }
func Getfilecon(path string) (string, int) { var scon string var con *C.char rc, _ := C.lgetfilecon(C.CString(path), &con) if rc > 0 { scon = C.GoString(con) C.free(unsafe.Pointer(con)) } return scon, int(rc) }