Fix SELinux function compatibility in older trees

Change-Id: I3d8c23b51b3331d062099c1edb1833551cc6af91
This commit is contained in:
Dees Troy
2014-02-03 14:58:32 +00:00
parent 3d2baacdaf
commit a7b8de514d

View File

@@ -45,8 +45,10 @@ using namespace rapidxml;
int fixPermissions::restorecon(string entry, struct stat *sb) {
char *oldcontext, *newcontext;
struct selabel_handle *sehandle;
sehandle = selinux_android_file_context_handle();
struct selinux_opt selinux_options[] = {
{ SELABEL_OPT_PATH, "/file_contexts" }
};
sehandle = selabel_open(SELABEL_CTX_FILE, selinux_options, 1);
if (lgetfilecon(entry.c_str(), &oldcontext) < 0) {
LOGINFO("Couldn't get selinux context for %s\n", entry.c_str());
return -1;