summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fixPermissions.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/fixPermissions.cpp b/fixPermissions.cpp
index b98a8c7f5..5d57b47a4 100644
--- a/fixPermissions.cpp
+++ b/fixPermissions.cpp
@@ -71,6 +71,10 @@ int fixPermissions::restorecon(string entry, struct stat *sb) {
int fixPermissions::fixDataDataContexts(void) {
string dir = "/data/data/";
sehandle = selabel_open(SELABEL_CTX_FILE, selinux_options, 1);
+ if (!sehandle) {
+ LOGINFO("Unable to open /file_contexts\n");
+ return 0;
+ }
if (TWFunc::Path_Exists(dir)) {
fixContextsRecursively(dir, 0);
}
@@ -112,7 +116,10 @@ int fixPermissions::fixDataInternalContexts(void) {
struct stat sb;
string dir, androiddir;
sehandle = selabel_open(SELABEL_CTX_FILE, selinux_options, 1);
-
+ if (!sehandle) {
+ LOGINFO("Unable to open /file_contexts\n");
+ return 0;
+ }
if (TWFunc::Path_Exists("/data/media/0"))
dir = "/data/media/0";
else