From 995e88cfbe90f451359c20cf8f54172a90749a5c Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Tue, 26 Nov 2013 21:39:14 +0000 Subject: Add check during boot for SELinux support Change-Id: Ib02867c403d1baa665dfb1d4f3137204e64a813c --- twrp.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/twrp.cpp b/twrp.cpp index 82704b51d..3a8dd8205 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -120,6 +120,18 @@ int main(int argc, char **argv) { printf("No file contexts for SELinux\n"); else printf("SELinux contexts loaded from /file_contexts\n"); + { // Check to ensure SELinux can be supported by the kernel + char *contexts = NULL; + lgetfilecon("/sbin/teamwin", &contexts); + if (!contexts) { + gui_print("Kernel does not have support for reading SELinux contexts.\n"); + } else { + free(contexts); + gui_print("Full SELinux support is present.\n"); + } + } +#else + gui_print("No SELinux support (no libselinux).\n"); #endif PartitionManager.Mount_By_Path("/cache", true); -- cgit v1.2.3